From 0a7a805b725001dc3744c261095cc72546115912 Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Tue, 22 Sep 2026 14:17:34 -0400 Subject: [PATCH 1/5] Regenerate codegen: prune orphan files, fix Guzzle 8 compatibility, restore crm/objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove 108 orphaned generated files left behind when APIs were retagged (e.g. Webhooks SubscriptionsApi/SettingsApi → BasicApi/BatchApi; CMS AuditLogs, SiteSearch, UrlRedirects, SourceCode; CRM Associations V4 stale models, etc.) - Guzzle 8 fixes (Utils::jsonEncode, RequestException::getResponse, ConnectException → NetworkException) now propagate to all 156+ generated clients - Restore crm/objects generation from the surviving Custom Objects spec (rollout 424); adds AdvancedApi + two new models (PublicMergeInput, PublicObjectWarning) Generator: HubSpotEngineering/api-clients #376 (Guzzle fixes) + #377 (pruning) Registry: crm/objects entry repointed from retired "Objects" to "Custom Objects" Co-Authored-By: Claude Sonnet 4.6 --- .../Automation/Actions/Api/CallbacksApi.php | 8 +- .../Automation/Actions/Api/DefinitionsApi.php | 69 +- .../Automation/Actions/Api/FunctionsApi.php | 67 +- .../Automation/Actions/Api/RevisionsApi.php | 18 +- .../Actions/Model/ChirpAiContextObject.php | 70 + .../Actions/Model/InputFieldDefinition.php | 547 -- codegen/Cms/AuditLogs/Api/AuditLogsApi.php | 583 -- codegen/Cms/AuditLogs/Api/BasicApi.php | 2 +- codegen/Cms/Blogs/Authors/Api/BasicApi.php | 14 +- codegen/Cms/Blogs/Authors/Api/BatchApi.php | 16 +- .../Cms/Blogs/Authors/Api/BlogAuthorsApi.php | 4190 --------- .../Blogs/Authors/Api/MultiLanguageApi.php | 20 +- codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php | 32 +- codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php | 16 +- .../Blogs/BlogPosts/Api/MultiLanguageApi.php | 20 +- .../Cms/Blogs/BlogPosts/Api/RevisionsApi.php | 8 +- ...ectionResponseWithTotalVersionBlogPost.php | 484 -- codegen/Cms/Blogs/Tags/Api/BasicApi.php | 14 +- codegen/Cms/Blogs/Tags/Api/BatchApi.php | 16 +- codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php | 4190 --------- .../Cms/Blogs/Tags/Api/MultiLanguageApi.php | 20 +- codegen/Cms/Domains/Api/BasicApi.php | 4 +- codegen/Cms/Domains/Api/DomainsApi.php | 902 -- ...onResponseWithTotalDomainForwardPaging.php | 483 - codegen/Cms/Domains/Model/ForwardPaging.php | 409 - codegen/Cms/Hubdb/Api/RowsApi.php | 50 +- codegen/Cms/Hubdb/Api/RowsBatchApi.php | 2364 ----- codegen/Cms/Hubdb/Api/TablesApi.php | 38 +- ...onseWithTotalHubDbTableV3ForwardPaging.php | 483 - codegen/Cms/Hubdb/Model/ForwardPaging.php | 409 - codegen/Cms/Pages/Api/ABTestsApi.php | 24 +- codegen/Cms/Pages/Api/AdvancedApi.php | 10 +- codegen/Cms/Pages/Api/BasicApi.php | 20 +- codegen/Cms/Pages/Api/BatchApi.php | 44 +- codegen/Cms/Pages/Api/FoldersApi.php | 24 +- codegen/Cms/Pages/Api/LandingPagesApi.php | 32 +- codegen/Cms/Pages/Api/MultiLanguageApi.php | 36 +- codegen/Cms/Pages/Api/SitePagesApi.php | 7738 ----------------- codegen/Cms/Pages/Api/WebsitePagesApi.php | 34 +- ...nResponseWithTotalVersionContentFolder.php | 484 -- ...CollectionResponseWithTotalVersionPage.php | 484 -- .../Cms/Pages/Model/VersionContentFolder.php | 524 -- codegen/Cms/Pages/Model/VersionPage.php | 524 -- codegen/Cms/SiteSearch/Api/BasicApi.php | 2 +- codegen/Cms/SiteSearch/Api/PublicApi.php | 1025 --- codegen/Cms/SiteSearch/Api/SearchApi.php | 747 -- .../SiteSearch/Model/ContentSearchResult.php | 2924 ------- .../SiteSearch/Model/PublicSearchResults.php | 594 -- codegen/Cms/SourceCode/Api/AdvancedApi.php | 12 +- codegen/Cms/SourceCode/Api/BasicApi.php | 6 +- codegen/Cms/SourceCode/Api/ContentApi.php | 1423 --- codegen/Cms/SourceCode/Api/ExtractApi.php | 771 -- codegen/Cms/SourceCode/Api/MetadataApi.php | 521 -- codegen/Cms/SourceCode/Api/ValidationApi.php | 511 -- codegen/Cms/UrlRedirects/Api/BasicApi.php | 1053 +-- codegen/Cms/UrlRedirects/Api/RedirectsApi.php | 1731 ---- .../Api/AdvancedApi.php | 8 +- .../CommunicationPreferences/Api/BasicApi.php | 4 +- .../Api/DefinitionsApi.php | 463 - .../Api/StatusApi.php | 1059 --- .../VisitorIdentification/Api/BasicApi.php | 4 +- .../VisitorIdentification/Api/GenerateApi.php | 482 - codegen/Crm/Associations/Api/BatchApi.php | 12 +- .../Crm/Associations/Schema/Api/BasicApi.php | 2 +- .../Crm/Associations/Schema/Api/TypesApi.php | 503 -- codegen/Crm/Associations/V4/Api/BasicApi.php | 10 +- codegen/Crm/Associations/V4/Api/BatchApi.php | 20 +- codegen/Crm/Associations/V4/Api/ReportApi.php | 2 +- .../BatchResponsePublicDefaultAssociation.php | 4 +- .../Model/MultiAssociatedObjectWithLabel.php | 2 +- .../V4/Model/PublicDefaultAssociation.php | 486 -- .../Api/DefinitionConfigurationsApi.php | 1756 ---- .../V4/Schema/Api/DefinitionsApi.php | 1376 --- .../Associations/V4/Schema/Api/LabelsApi.php | 12 +- .../Associations/V4/Schema/Api/LimitsApi.php | 16 +- .../V4/Schema/Model/BatchResponseVoid.php | 697 -- ...ectionResponseAssociationSpecWithLabel.php | 446 - ...AssociationDefinitionUserConfiguration.php | 446 - .../Associations/V4/Schema/Model/NextPage.php | 447 - .../Associations/V4/Schema/Model/Paging.php | 443 - .../V4/Schema/Model/PreviousPage.php | 447 - .../V4/Schema/Model/StandardError.php | 2 +- .../Crm/Commerce/Invoices/Api/BasicApi.php | 34 +- .../Crm/Commerce/Invoices/Api/BatchApi.php | 40 +- .../Crm/Commerce/Invoices/Api/SearchApi.php | 8 +- .../Commerce/Invoices/Model/AssociatedId.php | 2 +- .../Invoices/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Invoices/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Commerce/Invoices/Model/StandardError.php | 2 +- .../Invoices/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Companies/Api/AdvancedApi.php | 8 +- codegen/Crm/Companies/Api/BasicApi.php | 34 +- codegen/Crm/Companies/Api/BatchApi.php | 40 +- codegen/Crm/Companies/Api/SearchApi.php | 8 +- codegen/Crm/Companies/Model/AssociatedId.php | 2 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Companies/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/Companies/Model/StandardError.php | 2 +- .../Companies/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Contacts/Api/AdvancedApi.php | 16 +- codegen/Crm/Contacts/Api/BasicApi.php | 34 +- codegen/Crm/Contacts/Api/BatchApi.php | 40 +- codegen/Crm/Contacts/Api/SearchApi.php | 8 +- codegen/Crm/Contacts/Model/AssociatedId.php | 2 +- .../Crm/Contacts/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Crm/Contacts/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/Contacts/Model/StandardError.php | 2 +- .../Crm/Contacts/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Deals/Api/BasicApi.php | 42 +- codegen/Crm/Deals/Api/BatchApi.php | 40 +- codegen/Crm/Deals/Api/SearchApi.php | 8 +- .../BatchReadInputSimplePublicObjectId.php | 2 +- .../Model/BatchResponseSimplePublicObject.php | 2 +- .../BatchResponseSimplePublicUpsertObject.php | 2 +- ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Deals/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 2 +- codegen/Crm/Exports/Api/AdvancedApi.php | 6 +- codegen/Crm/Exports/Api/BasicApi.php | 2 +- codegen/Crm/Exports/Api/PublicExportsApi.php | 1060 --- codegen/Crm/Exports/Model/StandardError.php | 2 +- .../Extensions/Calling/Api/AdvancedApi.php | 8 +- .../Crm/Extensions/Calling/Api/BasicApi.php | 115 +- .../Crm/Extensions/Calling/Api/BatchApi.php | 4 +- .../Api/ChannelConnectionSettingsApi.php | 1336 --- .../Calling/Api/RecordingSettingsApi.php | 1334 --- .../Extensions/Calling/Api/SettingsApi.php | 1336 --- .../Crm/Extensions/Cards/Api/AdvancedApi.php | 11 +- codegen/Crm/Extensions/Cards/Api/BasicApi.php | 51 +- codegen/Crm/Extensions/Cards/Api/CardsApi.php | 1686 ---- .../Cards/Api/SampleResponseApi.php | 459 - .../Videoconferencing/Api/BasicApi.php | 29 +- .../Videoconferencing/Api/SettingsApi.php | 1027 --- codegen/Crm/Imports/Api/AdvancedApi.php | 4 +- codegen/Crm/Imports/Api/BasicApi.php | 6 +- codegen/Crm/Imports/Api/CoreApi.php | 1378 --- codegen/Crm/Imports/Api/PublicImportsApi.php | 543 -- ...CollectionResponsePublicImportResponse.php | 446 - codegen/Crm/Imports/Model/Paging.php | 443 - codegen/Crm/Imports/Model/PreviousPage.php | 447 - codegen/Crm/LineItems/Api/BasicApi.php | 34 +- codegen/Crm/LineItems/Api/BatchApi.php | 40 +- codegen/Crm/LineItems/Api/SearchApi.php | 8 +- codegen/Crm/LineItems/Model/AssociatedId.php | 2 +- .../Crm/LineItems/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../LineItems/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/LineItems/Model/StandardError.php | 2 +- .../LineItems/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Lists/Api/BasicApi.php | 74 +- codegen/Crm/Lists/Api/BatchApi.php | 4 +- codegen/Crm/Lists/Api/IDMappingApi.php | 766 -- codegen/Crm/Lists/Api/JoinOrderApi.php | 528 -- codegen/Crm/Lists/Api/ListManagementApi.php | 2674 ------ codegen/Crm/Lists/Api/ListsApi.php | 2805 ------ codegen/Crm/Lists/Api/MembershipsApi.php | 2247 ----- codegen/Crm/Lists/Api/SearchApi.php | 4 +- ...onResponseRecordListMembershipNoPaging.php | 446 - .../Model/PublicCampaignInfluencedFilter.php | 481 - ...FormSubmissionFilterCoalescingRefineBy.php | 1175 --- ...licFormSubmissionFilterPruningRefineBy.php | 1175 --- .../Model/PublicNumAssociationsFilter.php | 555 -- ...umAssociationsFilterCoalescingRefineBy.php | 1175 --- .../PublicPropertyAssociationFilterBranch.php | 666 -- ...ciationFilterBranchFilterBranchesInner.php | 814 -- ...rtyAssociationFilterBranchFiltersInner.php | 2042 ----- .../PublicPropertyAssociationInListFilter.php | 626 -- .../Api/AdvancedApi.php} | 160 +- codegen/Crm/Objects/Api/BasicApi.php | 329 +- codegen/Crm/Objects/Api/BatchApi.php | 371 +- codegen/Crm/Objects/Api/SearchApi.php | 29 +- codegen/Crm/Objects/ApiException.php | 2 +- codegen/Crm/Objects/Calls/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Calls/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Calls/Api/SearchApi.php | 8 +- .../Crm/Objects/Calls/Model/AssociatedId.php | 2 +- .../Objects/Calls/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Calls/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Calls/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Calls/Model/StandardError.php | 2 +- .../Calls/Model/ValueWithTimestamp.php | 4 +- .../Objects/Communications/Api/BasicApi.php | 34 +- .../Objects/Communications/Api/BatchApi.php | 40 +- .../Objects/Communications/Api/SearchApi.php | 8 +- .../Communications/Model/AssociatedId.php | 2 +- .../Communications/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Communications/Model/StandardError.php | 2 +- .../Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Configuration.php | 2 +- .../Crm/Objects/DealSplits/Api/BatchApi.php | 8 +- .../DealSplits/Model/SimplePublicObject.php | 4 +- .../DealSplits/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Emails/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Emails/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Emails/Api/SearchApi.php | 8 +- .../Crm/Objects/Emails/Model/AssociatedId.php | 2 +- .../Objects/Emails/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Emails/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Emails/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Objects/Emails/Model/StandardError.php | 2 +- .../Emails/Model/ValueWithTimestamp.php | 4 +- .../FeedbackSubmissions/Api/BasicApi.php | 12 +- .../FeedbackSubmissions/Api/BatchApi.php | 8 +- .../FeedbackSubmissions/Api/SearchApi.php | 8 +- .../Model/AssociatedId.php | 2 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Model/StandardError.php | 2 +- .../Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/FormDataProcessor.php | 2 +- codegen/Crm/Objects/Goals/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Goals/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Goals/Api/SearchApi.php | 8 +- .../Crm/Objects/Goals/Model/AssociatedId.php | 2 +- .../Objects/Goals/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Goals/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Goals/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Goals/Model/StandardError.php | 2 +- .../Goals/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/HeaderSelector.php | 2 +- codegen/Crm/Objects/Leads/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Leads/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Leads/Api/SearchApi.php | 8 +- .../Crm/Objects/Leads/Model/AssociatedId.php | 2 +- .../Objects/Leads/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Leads/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Leads/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Leads/Model/StandardError.php | 2 +- .../Leads/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Meetings/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Meetings/Api/BatchApi.php | 40 +- .../Crm/Objects/Meetings/Api/SearchApi.php | 8 +- .../Objects/Meetings/Model/AssociatedId.php | 2 +- .../Meetings/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Meetings/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Objects/Meetings/Model/StandardError.php | 2 +- .../Meetings/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Model/AssociatedId.php | 6 +- codegen/Crm/Objects/Model/AssociationSpec.php | 6 +- ...BatchInputSimplePublicObjectBatchInput.php | 5 +- ...tSimplePublicObjectBatchInputForCreate.php | 5 +- ...nputSimplePublicObjectBatchInputUpsert.php | 5 +- .../Model/BatchInputSimplePublicObjectId.php | 5 +- .../BatchReadInputSimplePublicObjectId.php | 8 +- .../Model/BatchResponseSimplePublicObject.php | 8 +- ...chResponseSimplePublicObjectWithErrors.php | 2 +- .../BatchResponseSimplePublicUpsertObject.php | 8 +- ...onseSimplePublicUpsertObjectWithErrors.php | 2 +- .../Model/CollectionResponseAssociatedId.php | 5 +- ...licObjectWithAssociationsForwardPaging.php | 5 +- ...ionResponseWithTotalSimplePublicObject.php | 4 +- codegen/Crm/Objects/Model/Error.php | 3 +- codegen/Crm/Objects/Model/ErrorDetail.php | 3 +- codegen/Crm/Objects/Model/Filter.php | 4 +- codegen/Crm/Objects/Model/FilterGroup.php | 5 +- codegen/Crm/Objects/Model/ForwardPaging.php | 3 +- codegen/Crm/Objects/Model/ModelInterface.php | 2 +- codegen/Crm/Objects/Model/NextPage.php | 2 +- codegen/Crm/Objects/Model/Paging.php | 3 +- codegen/Crm/Objects/Model/PreviousPage.php | 2 +- .../Model/PublicAssociationsForObject.php | 5 +- .../Model/PublicMergeInput.php} | 94 +- codegen/Crm/Objects/Model/PublicObjectId.php | 2 +- .../Model/PublicObjectSearchRequest.php | 2 +- .../PublicObjectWarning.php} | 131 +- .../Crm/Objects/Model/SimplePublicObject.php | 54 +- .../Model/SimplePublicObjectBatchInput.php | 2 +- .../SimplePublicObjectBatchInputForCreate.php | 4 +- .../SimplePublicObjectBatchInputUpsert.php | 2 +- .../Objects/Model/SimplePublicObjectId.php | 2 +- .../Objects/Model/SimplePublicObjectInput.php | 4 +- .../SimplePublicObjectInputForCreate.php | 4 +- .../SimplePublicObjectWithAssociations.php | 52 +- .../Model/SimplePublicUpsertObject.php | 50 +- codegen/Crm/Objects/Model/StandardError.php | 4 +- .../Crm/Objects/Model/ValueWithTimestamp.php | 6 +- codegen/Crm/Objects/Notes/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Notes/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Notes/Api/SearchApi.php | 8 +- .../Crm/Objects/Notes/Model/AssociatedId.php | 2 +- .../Objects/Notes/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Notes/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Notes/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Notes/Model/StandardError.php | 2 +- .../Notes/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/ObjectSerializer.php | 2 +- .../Crm/Objects/PostalMail/Api/BasicApi.php | 34 +- .../Crm/Objects/PostalMail/Api/BatchApi.php | 40 +- .../Crm/Objects/PostalMail/Api/SearchApi.php | 8 +- .../Objects/PostalMail/Model/AssociatedId.php | 2 +- .../PostalMail/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 8 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../PostalMail/Model/SimplePublicObject.php | 2 +- .../Model/SimplePublicObjectBatchInput.php | 2 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../PostalMail/Model/StandardError.php | 2 +- .../PostalMail/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Tasks/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Tasks/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Tasks/Api/SearchApi.php | 8 +- .../Crm/Objects/Tasks/Model/AssociatedId.php | 2 +- .../Objects/Tasks/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Tasks/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Tasks/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Tasks/Model/StandardError.php | 2 +- .../Tasks/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Objects/Taxes/Api/BasicApi.php | 34 +- codegen/Crm/Objects/Taxes/Api/BatchApi.php | 40 +- codegen/Crm/Objects/Taxes/Api/SearchApi.php | 8 +- .../Crm/Objects/Taxes/Model/AssociatedId.php | 2 +- .../Objects/Taxes/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Taxes/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Taxes/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- .../Crm/Objects/Taxes/Model/StandardError.php | 2 +- .../Taxes/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Owners/Api/BasicApi.php | 4 +- codegen/Crm/Owners/Api/OwnersApi.php | 842 -- codegen/Crm/Pipelines/Api/BasicApi.php | 40 +- .../Pipelines/Api/PipelineStageAuditsApi.php | 526 -- .../Crm/Pipelines/Api/PipelineStagesApi.php | 2129 ----- codegen/Crm/Pipelines/Api/PipelinesApi.php | 2099 ----- codegen/Crm/Products/Api/BasicApi.php | 34 +- codegen/Crm/Products/Api/BatchApi.php | 40 +- codegen/Crm/Products/Api/SearchApi.php | 8 +- codegen/Crm/Products/Model/AssociatedId.php | 2 +- .../Crm/Products/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Crm/Products/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/Products/Model/StandardError.php | 2 +- .../Crm/Products/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Properties/Api/BasicApi.php | 14 +- codegen/Crm/Properties/Api/BatchApi.php | 12 +- codegen/Crm/Properties/Api/CoreApi.php | 14 +- codegen/Crm/Properties/Api/GroupsApi.php | 1711 ---- codegen/Crm/Quotes/Api/BasicApi.php | 34 +- codegen/Crm/Quotes/Api/BatchApi.php | 40 +- codegen/Crm/Quotes/Api/SearchApi.php | 8 +- codegen/Crm/Quotes/Model/AssociatedId.php | 2 +- codegen/Crm/Quotes/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Crm/Quotes/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Quotes/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/Quotes/Model/StandardError.php | 2 +- .../Crm/Quotes/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Schemas/Api/AdvancedApi.php | 4 +- codegen/Crm/Schemas/Api/BasicApi.php | 16 +- codegen/Crm/Schemas/Api/BatchApi.php | 4 +- codegen/Crm/Schemas/Api/CoreApi.php | 2116 ----- codegen/Crm/Tickets/Api/AdvancedApi.php | 4 +- codegen/Crm/Tickets/Api/BasicApi.php | 14 +- codegen/Crm/Tickets/Api/BatchApi.php | 20 +- codegen/Crm/Tickets/Api/SearchApi.php | 4 +- codegen/Crm/Tickets/Model/AssociatedId.php | 2 +- codegen/Crm/Tickets/Model/AssociationSpec.php | 4 +- .../BatchReadInputSimplePublicObjectId.php | 6 +- .../Model/BatchResponseSimplePublicObject.php | 4 +- .../BatchResponseSimplePublicUpsertObject.php | 4 +- ...onseSimplePublicObjectWithAssociations.php | 446 - ...ionResponseWithTotalSimplePublicObject.php | 2 +- .../Crm/Tickets/Model/SimplePublicObject.php | 4 +- .../SimplePublicObjectBatchInputForCreate.php | 2 +- .../Tickets/Model/SimplePublicObjectInput.php | 2 +- .../SimplePublicObjectInputForCreate.php | 2 +- .../SimplePublicObjectWithAssociations.php | 4 +- codegen/Crm/Tickets/Model/StandardError.php | 2 +- .../Crm/Tickets/Model/ValueWithTimestamp.php | 4 +- codegen/Crm/Timeline/Api/AdvancedApi.php | 15 +- codegen/Crm/Timeline/Api/BasicApi.php | 71 +- codegen/Crm/Timeline/Api/BatchApi.php | 4 +- codegen/Crm/Timeline/Api/EventsApi.php | 1672 ---- codegen/Crm/Timeline/Api/TemplatesApi.php | 1686 ---- codegen/Crm/Timeline/Api/TokensApi.php | 1146 --- codegen/Crm/Timeline/Model/EventDetail.php | 413 - codegen/Events/Api/BasicApi.php | 12 +- codegen/Events/Api/EventsApi.php | 912 -- codegen/Events/Send/Api/BasicApi.php | 4 +- codegen/Events/Send/Api/BatchApi.php | 4 +- codegen/Files/Api/BasicApi.php | 2 +- codegen/Files/Api/FilesApi.php | 30 +- codegen/Files/Api/FoldersApi.php | 20 +- codegen/Files/Model/StandardError.php | 2 +- codegen/Marketing/Emails/Api/BasicApi.php | 10 +- codegen/Marketing/Emails/Api/EmailsApi.php | 38 +- .../Marketing/Emails/Api/StatisticsApi.php | 852 -- ...ithTotalEmailStatisticIntervalNoPaging.php | 450 - ...ponseWithTotalPublicEmailForwardPaging.php | 484 -- ...ionResponseWithTotalVersionPublicEmail.php | 484 -- .../Marketing/Emails/Model/ForwardPaging.php | 409 - codegen/Marketing/Events/Api/BasicApi.php | 26 +- codegen/Marketing/Events/Api/BatchApi.php | 16 +- .../Events/Api/EventAttendeesApi.php | 16 +- .../Marketing/Events/Api/EventStatusApi.php | 6 +- .../Marketing/Events/Api/IdentifiersApi.php | 4 +- .../Events/Api/ListAssociationsApi.php | 12 +- .../Events/Api/ParticipantStateApi.php | 10 +- codegen/Marketing/Events/Api/SettingsApi.php | 20 +- .../Events/Api/SubscriberStateChangesApi.php | 8 +- ...ketingEventIdentifiersResponseNoPaging.php | 449 - ...talParticipationBreakdownForwardPaging.php | 483 - ...ionResponseWithTotalPublicListNoPaging.php | 449 - codegen/Marketing/Forms/Api/BasicApi.php | 18 +- codegen/Marketing/Forms/Api/FormsApi.php | 1964 ----- ...FormDefinitionAllOfLegalConsentOptions.php | 773 -- ...nCreateRequestAllOfLegalConsentOptions.php | 773 -- .../Transactional/Api/SMTPTokensApi.php | 12 +- .../Api/SendTransactionalEmailApi.php | 4 +- codegen/Oauth/Api/AccessTokensApi.php | 2 +- codegen/Oauth/Api/RefreshTokensApi.php | 4 +- codegen/Oauth/Api/TokensApi.php | 2 +- .../Settings/BusinessUnits/Api/BasicApi.php | 2 +- .../BusinessUnits/Api/BusinessUnitsApi.php | 513 -- codegen/Settings/Users/Api/BasicApi.php | 6 +- codegen/Settings/Users/Api/RolesApi.php | 2 +- codegen/Settings/Users/Api/TeamsApi.php | 2 +- codegen/Settings/Users/Api/UsersApi.php | 8 +- codegen/Webhooks/Api/BasicApi.php | 78 +- codegen/Webhooks/Api/BatchApi.php | 11 +- codegen/Webhooks/Api/SettingsApi.php | 1027 --- codegen/Webhooks/Api/SubscriptionsApi.php | 2009 ----- 553 files changed, 2476 insertions(+), 110843 deletions(-) delete mode 100644 codegen/Automation/Actions/Model/InputFieldDefinition.php delete mode 100644 codegen/Cms/AuditLogs/Api/AuditLogsApi.php delete mode 100644 codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php delete mode 100644 codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php delete mode 100644 codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php delete mode 100644 codegen/Cms/Domains/Api/DomainsApi.php delete mode 100644 codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php delete mode 100644 codegen/Cms/Domains/Model/ForwardPaging.php delete mode 100644 codegen/Cms/Hubdb/Api/RowsBatchApi.php delete mode 100644 codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php delete mode 100644 codegen/Cms/Hubdb/Model/ForwardPaging.php delete mode 100644 codegen/Cms/Pages/Api/SitePagesApi.php delete mode 100644 codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php delete mode 100644 codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php delete mode 100644 codegen/Cms/Pages/Model/VersionContentFolder.php delete mode 100644 codegen/Cms/Pages/Model/VersionPage.php delete mode 100644 codegen/Cms/SiteSearch/Api/PublicApi.php delete mode 100644 codegen/Cms/SiteSearch/Api/SearchApi.php delete mode 100644 codegen/Cms/SiteSearch/Model/ContentSearchResult.php delete mode 100644 codegen/Cms/SiteSearch/Model/PublicSearchResults.php delete mode 100644 codegen/Cms/SourceCode/Api/ContentApi.php delete mode 100644 codegen/Cms/SourceCode/Api/ExtractApi.php delete mode 100644 codegen/Cms/SourceCode/Api/MetadataApi.php delete mode 100644 codegen/Cms/SourceCode/Api/ValidationApi.php delete mode 100644 codegen/Cms/UrlRedirects/Api/RedirectsApi.php delete mode 100644 codegen/CommunicationPreferences/Api/DefinitionsApi.php delete mode 100644 codegen/CommunicationPreferences/Api/StatusApi.php delete mode 100644 codegen/Conversations/VisitorIdentification/Api/GenerateApi.php delete mode 100644 codegen/Crm/Associations/Schema/Api/TypesApi.php delete mode 100644 codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/BatchResponseVoid.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabel.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfiguration.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/NextPage.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/Paging.php delete mode 100644 codegen/Crm/Associations/V4/Schema/Model/PreviousPage.php delete mode 100644 codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Exports/Api/PublicExportsApi.php delete mode 100644 codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php delete mode 100644 codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php delete mode 100644 codegen/Crm/Extensions/Calling/Api/SettingsApi.php delete mode 100644 codegen/Crm/Extensions/Cards/Api/CardsApi.php delete mode 100644 codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php delete mode 100644 codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php delete mode 100644 codegen/Crm/Imports/Api/CoreApi.php delete mode 100644 codegen/Crm/Imports/Api/PublicImportsApi.php delete mode 100644 codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php delete mode 100644 codegen/Crm/Imports/Model/Paging.php delete mode 100644 codegen/Crm/Imports/Model/PreviousPage.php delete mode 100644 codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Lists/Api/IDMappingApi.php delete mode 100644 codegen/Crm/Lists/Api/JoinOrderApi.php delete mode 100644 codegen/Crm/Lists/Api/ListManagementApi.php delete mode 100644 codegen/Crm/Lists/Api/ListsApi.php delete mode 100644 codegen/Crm/Lists/Api/MembershipsApi.php delete mode 100644 codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php delete mode 100644 codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php delete mode 100644 codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php delete mode 100644 codegen/Crm/Lists/Model/PublicFormSubmissionFilterPruningRefineBy.php delete mode 100644 codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php delete mode 100644 codegen/Crm/Lists/Model/PublicNumAssociationsFilterCoalescingRefineBy.php delete mode 100644 codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php delete mode 100644 codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php delete mode 100644 codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php delete mode 100644 codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php rename codegen/Crm/{Pipelines/Api/PipelineAuditsApi.php => Objects/Api/AdvancedApi.php} (64%) delete mode 100644 codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociations.php rename codegen/Crm/{Deals/Model/CollectionResponseSimplePublicObjectWithAssociations.php => Objects/Model/PublicMergeInput.php} (79%) rename codegen/Crm/Objects/{Communications/Model/CollectionResponseSimplePublicObjectWithAssociations.php => Model/PublicObjectWarning.php} (75%) delete mode 100644 codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Owners/Api/OwnersApi.php delete mode 100644 codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php delete mode 100644 codegen/Crm/Pipelines/Api/PipelineStagesApi.php delete mode 100644 codegen/Crm/Pipelines/Api/PipelinesApi.php delete mode 100644 codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Properties/Api/GroupsApi.php delete mode 100644 codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Schemas/Api/CoreApi.php delete mode 100644 codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociations.php delete mode 100644 codegen/Crm/Timeline/Api/EventsApi.php delete mode 100644 codegen/Crm/Timeline/Api/TemplatesApi.php delete mode 100644 codegen/Crm/Timeline/Api/TokensApi.php delete mode 100644 codegen/Crm/Timeline/Model/EventDetail.php delete mode 100644 codegen/Events/Api/EventsApi.php delete mode 100644 codegen/Marketing/Emails/Api/StatisticsApi.php delete mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php delete mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php delete mode 100644 codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php delete mode 100644 codegen/Marketing/Emails/Model/ForwardPaging.php delete mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php delete mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php delete mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php delete mode 100644 codegen/Marketing/Forms/Api/FormsApi.php delete mode 100644 codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php delete mode 100644 codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php delete mode 100644 codegen/Settings/BusinessUnits/Api/BusinessUnitsApi.php delete mode 100644 codegen/Webhooks/Api/SettingsApi.php delete mode 100644 codegen/Webhooks/Api/SubscriptionsApi.php diff --git a/codegen/Automation/Actions/Api/CallbacksApi.php b/codegen/Automation/Actions/Api/CallbacksApi.php index c1befa68..9f569ce1 100644 --- a/codegen/Automation/Actions/Api/CallbacksApi.php +++ b/codegen/Automation/Actions/Api/CallbacksApi.php @@ -322,7 +322,7 @@ public function completeRequest($callback_id, $callback_completion_request, stri if (isset($callback_completion_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($callback_completion_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $callback_completion_request; } @@ -343,7 +343,7 @@ public function completeRequest($callback_id, $callback_completion_request, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -551,7 +551,7 @@ public function completeBatchRequest($batch_input_callback_completion_batch_requ if (isset($batch_input_callback_completion_batch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_callback_completion_batch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_callback_completion_batch_request; } @@ -572,7 +572,7 @@ public function completeBatchRequest($batch_input_callback_completion_batch_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Automation/Actions/Api/DefinitionsApi.php b/codegen/Automation/Actions/Api/DefinitionsApi.php index bb87c738..c033b3fe 100644 --- a/codegen/Automation/Actions/Api/DefinitionsApi.php +++ b/codegen/Automation/Actions/Api/DefinitionsApi.php @@ -359,16 +359,17 @@ public function archiveRequest($app_id, $definition_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -665,16 +666,17 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObjectRequest($app_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -913,7 +915,7 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObject_0Request($app if (isset($public_action_definition_requires_object_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_requires_object_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_requires_object_request; } @@ -934,16 +936,17 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObject_0Request($app } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1218,7 +1221,7 @@ public function createRequest($app_id, $public_action_definition_egg, string $co if (isset($public_action_definition_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_egg), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_egg; } @@ -1239,16 +1242,17 @@ public function createRequest($app_id, $public_action_definition_egg, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1560,16 +1564,17 @@ public function getByIdRequest($app_id, $definition_id, $archived = false, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1891,16 +1896,17 @@ public function getPageRequest($app_id, $after = null, $archived = false, $limit } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2195,7 +2201,7 @@ public function updateRequest($app_id, $definition_id, $public_action_definition if (isset($public_action_definition_patch)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_patch), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_patch; } @@ -2216,16 +2222,17 @@ public function updateRequest($app_id, $definition_id, $public_action_definition } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Automation/Actions/Api/FunctionsApi.php b/codegen/Automation/Actions/Api/FunctionsApi.php index 526fe8af..683d7547 100644 --- a/codegen/Automation/Actions/Api/FunctionsApi.php +++ b/codegen/Automation/Actions/Api/FunctionsApi.php @@ -399,16 +399,17 @@ public function archiveRequest($app_id, $definition_id, $function_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -669,16 +670,17 @@ public function archiveByFunctionTypeRequest($app_id, $definition_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1013,7 +1015,7 @@ public function createOrReplaceRequest($app_id, $definition_id, $function_id, $f if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1034,16 +1036,17 @@ public function createOrReplaceRequest($app_id, $definition_id, $function_id, $f } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1358,7 +1361,7 @@ public function createOrReplaceByFunctionTypeRequest($app_id, $definition_id, $f if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1379,16 +1382,17 @@ public function createOrReplaceByFunctionTypeRequest($app_id, $definition_id, $f } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1705,16 +1709,17 @@ public function getByFunctionTypeRequest($app_id, $definition_id, $function_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2051,16 +2056,17 @@ public function getByIdRequest($app_id, $definition_id, $function_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2357,16 +2363,17 @@ public function getPageRequest($app_id, $definition_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Automation/Actions/Api/RevisionsApi.php b/codegen/Automation/Actions/Api/RevisionsApi.php index d9c2e535..b800be96 100644 --- a/codegen/Automation/Actions/Api/RevisionsApi.php +++ b/codegen/Automation/Actions/Api/RevisionsApi.php @@ -420,16 +420,17 @@ public function getByIdRequest($app_id, $definition_id, $revision_id, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -756,16 +757,17 @@ public function getPageRequest($app_id, $definition_id, $after = null, $limit = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Automation/Actions/Model/ChirpAiContextObject.php b/codegen/Automation/Actions/Model/ChirpAiContextObject.php index c56c9a15..5dfc2524 100644 --- a/codegen/Automation/Actions/Model/ChirpAiContextObject.php +++ b/codegen/Automation/Actions/Model/ChirpAiContextObject.php @@ -66,6 +66,7 @@ class ChirpAiContextObject implements ModelInterface, ArrayAccess, \JsonSerializ 'is_private' => 'bool', 'metadata' => 'array', 'otel_context_holder' => 'array', + 'sensitivity' => 'string', 'trajectory_id' => 'string', 'unstructured_sources' => 'string[]' ]; @@ -87,6 +88,7 @@ class ChirpAiContextObject implements ModelInterface, ArrayAccess, \JsonSerializ 'is_private' => null, 'metadata' => null, 'otel_context_holder' => null, + 'sensitivity' => null, 'trajectory_id' => 'uuid', 'unstructured_sources' => null ]; @@ -106,6 +108,7 @@ class ChirpAiContextObject implements ModelInterface, ArrayAccess, \JsonSerializ 'is_private' => false, 'metadata' => false, 'otel_context_holder' => false, + 'sensitivity' => false, 'trajectory_id' => false, 'unstructured_sources' => false ]; @@ -205,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'is_private' => 'isPrivate', 'metadata' => 'metadata', 'otel_context_holder' => 'otelContextHolder', + 'sensitivity' => 'sensitivity', 'trajectory_id' => 'trajectoryId', 'unstructured_sources' => 'unstructuredSources' ]; @@ -224,6 +228,7 @@ public function isNullableSetToNull(string $property): bool 'is_private' => 'setIsPrivate', 'metadata' => 'setMetadata', 'otel_context_holder' => 'setOtelContextHolder', + 'sensitivity' => 'setSensitivity', 'trajectory_id' => 'setTrajectoryId', 'unstructured_sources' => 'setUnstructuredSources' ]; @@ -243,6 +248,7 @@ public function isNullableSetToNull(string $property): bool 'is_private' => 'getIsPrivate', 'metadata' => 'getMetadata', 'otel_context_holder' => 'getOtelContextHolder', + 'sensitivity' => 'getSensitivity', 'trajectory_id' => 'getTrajectoryId', 'unstructured_sources' => 'getUnstructuredSources' ]; @@ -288,6 +294,9 @@ public function getModelName() return self::$openAPIModelName; } + public const SENSITIVITY_HIPAA = 'HIPAA'; + public const SENSITIVITY_NOT_SENSITIVE = 'NOT_SENSITIVE'; + public const SENSITIVITY_SENSITIVE = 'SENSITIVE'; public const UNSTRUCTURED_SOURCES_NONE = 'NONE'; public const UNSTRUCTURED_SOURCES_USER_INPUT = 'USER_INPUT'; public const UNSTRUCTURED_SOURCES_LOGGED_EMAIL = 'LOGGED_EMAIL'; @@ -310,6 +319,20 @@ public function getModelName() public const UNSTRUCTURED_SOURCES_NOTE = 'NOTE'; public const UNSTRUCTURED_SOURCES_DERIVED = 'DERIVED'; + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSensitivityAllowableValues() + { + return [ + self::SENSITIVITY_HIPAA, + self::SENSITIVITY_NOT_SENSITIVE, + self::SENSITIVITY_SENSITIVE, + ]; + } + /** * Gets allowable values of the enum * @@ -366,6 +389,7 @@ public function __construct(?array $data = null) $this->setIfExists('is_private', $data ?? [], null); $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('otel_context_holder', $data ?? [], null); + $this->setIfExists('sensitivity', $data ?? [], null); $this->setIfExists('trajectory_id', $data ?? [], null); $this->setIfExists('unstructured_sources', $data ?? [], null); } @@ -412,6 +436,15 @@ public function listInvalidProperties() if ($this->container['otel_context_holder'] === null) { $invalidProperties[] = "'otel_context_holder' can't be null"; } + $allowedValues = $this->getSensitivityAllowableValues(); + if (!is_null($this->container['sensitivity']) && !in_array($this->container['sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sensitivity', must be one of '%s'", + $this->container['sensitivity'], + implode("', '", $allowedValues) + ); + } + if ($this->container['unstructured_sources'] === null) { $invalidProperties[] = "'unstructured_sources' can't be null"; } @@ -673,6 +706,43 @@ public function setOtelContextHolder($otel_context_holder) return $this; } + /** + * Gets sensitivity + * + * @return string|null + */ + public function getSensitivity() + { + return $this->container['sensitivity']; + } + + /** + * Sets sensitivity + * + * @param string|null $sensitivity sensitivity + * + * @return self + */ + public function setSensitivity($sensitivity) + { + if (is_null($sensitivity)) { + throw new \InvalidArgumentException('non-nullable sensitivity cannot be null'); + } + $allowedValues = $this->getSensitivityAllowableValues(); + if (!in_array($sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sensitivity', must be one of '%s'", + $sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['sensitivity'] = $sensitivity; + + return $this; + } + /** * Gets trajectory_id * diff --git a/codegen/Automation/Actions/Model/InputFieldDefinition.php b/codegen/Automation/Actions/Model/InputFieldDefinition.php deleted file mode 100644 index 05f767a4..00000000 --- a/codegen/Automation/Actions/Model/InputFieldDefinition.php +++ /dev/null @@ -1,547 +0,0 @@ - - */ -class InputFieldDefinition implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'InputFieldDefinition'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'automation_field_type' => 'string', - 'is_required' => 'bool', - 'supported_value_types' => 'string[]', - 'type_definition' => '\HubSpot\Client\Automation\Actions\Model\FieldTypeDefinition' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'automation_field_type' => null, - 'is_required' => null, - 'supported_value_types' => null, - 'type_definition' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'automation_field_type' => false, - 'is_required' => false, - 'supported_value_types' => false, - 'type_definition' => 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 = [ - 'automation_field_type' => 'automationFieldType', - 'is_required' => 'isRequired', - 'supported_value_types' => 'supportedValueTypes', - 'type_definition' => 'typeDefinition' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'automation_field_type' => 'setAutomationFieldType', - 'is_required' => 'setIsRequired', - 'supported_value_types' => 'setSupportedValueTypes', - 'type_definition' => 'setTypeDefinition' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'automation_field_type' => 'getAutomationFieldType', - 'is_required' => 'getIsRequired', - 'supported_value_types' => 'getSupportedValueTypes', - 'type_definition' => 'getTypeDefinition' - ]; - - /** - * 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 SUPPORTED_VALUE_TYPES_STATIC_VALUE = 'STATIC_VALUE'; - public const SUPPORTED_VALUE_TYPES_OBJECT_PROPERTY = 'OBJECT_PROPERTY'; - public const SUPPORTED_VALUE_TYPES_FIELD_DATA = 'FIELD_DATA'; - public const SUPPORTED_VALUE_TYPES_FETCHED_OBJECT_PROPERTY = 'FETCHED_OBJECT_PROPERTY'; - public const SUPPORTED_VALUE_TYPES_ENROLLMENT_EVENT_PROPERTY = 'ENROLLMENT_EVENT_PROPERTY'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getSupportedValueTypesAllowableValues() - { - return [ - self::SUPPORTED_VALUE_TYPES_STATIC_VALUE, - self::SUPPORTED_VALUE_TYPES_OBJECT_PROPERTY, - self::SUPPORTED_VALUE_TYPES_FIELD_DATA, - self::SUPPORTED_VALUE_TYPES_FETCHED_OBJECT_PROPERTY, - self::SUPPORTED_VALUE_TYPES_ENROLLMENT_EVENT_PROPERTY, - ]; - } - - /** - * 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('automation_field_type', $data ?? [], null); - $this->setIfExists('is_required', $data ?? [], null); - $this->setIfExists('supported_value_types', $data ?? [], null); - $this->setIfExists('type_definition', $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_required'] === null) { - $invalidProperties[] = "'is_required' can't be null"; - } - if ($this->container['type_definition'] === null) { - $invalidProperties[] = "'type_definition' 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 automation_field_type - * - * @return string|null - */ - public function getAutomationFieldType() - { - return $this->container['automation_field_type']; - } - - /** - * Sets automation_field_type - * - * @param string|null $automation_field_type automation_field_type - * - * @return self - */ - public function setAutomationFieldType($automation_field_type) - { - if (is_null($automation_field_type)) { - throw new \InvalidArgumentException('non-nullable automation_field_type cannot be null'); - } - $this->container['automation_field_type'] = $automation_field_type; - - return $this; - } - - /** - * Gets is_required - * - * @return bool - */ - public function getIsRequired() - { - return $this->container['is_required']; - } - - /** - * Sets is_required - * - * @param bool $is_required is_required - * - * @return self - */ - public function setIsRequired($is_required) - { - if (is_null($is_required)) { - throw new \InvalidArgumentException('non-nullable is_required cannot be null'); - } - $this->container['is_required'] = $is_required; - - return $this; - } - - /** - * Gets supported_value_types - * - * @return string[]|null - */ - public function getSupportedValueTypes() - { - return $this->container['supported_value_types']; - } - - /** - * Sets supported_value_types - * - * @param string[]|null $supported_value_types supported_value_types - * - * @return self - */ - public function setSupportedValueTypes($supported_value_types) - { - if (is_null($supported_value_types)) { - throw new \InvalidArgumentException('non-nullable supported_value_types cannot be null'); - } - $allowedValues = $this->getSupportedValueTypesAllowableValues(); - if (array_diff($supported_value_types, $allowedValues)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'supported_value_types', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['supported_value_types'] = $supported_value_types; - - return $this; - } - - /** - * Gets type_definition - * - * @return \HubSpot\Client\Automation\Actions\Model\FieldTypeDefinition - */ - public function getTypeDefinition() - { - return $this->container['type_definition']; - } - - /** - * Sets type_definition - * - * @param \HubSpot\Client\Automation\Actions\Model\FieldTypeDefinition $type_definition type_definition - * - * @return self - */ - public function setTypeDefinition($type_definition) - { - if (is_null($type_definition)) { - throw new \InvalidArgumentException('non-nullable type_definition cannot be null'); - } - $this->container['type_definition'] = $type_definition; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/AuditLogs/Api/AuditLogsApi.php b/codegen/Cms/AuditLogs/Api/AuditLogsApi.php deleted file mode 100644 index f2bb5454..00000000 --- a/codegen/Cms/AuditLogs/Api/AuditLogsApi.php +++ /dev/null @@ -1,583 +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, - 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 getPage - * - * Query audit logs - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog|\HubSpot\Client\Cms\AuditLogs\Model\Error - */ - public function getPage($user_id = null, $event_type = null, $object_type = null, $object_id = null, $after = null, $before = null, $limit = null, $sort = null, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($user_id, $event_type, $object_type, $object_id, $after, $before, $limit, $sort, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Query audit logs - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog|\HubSpot\Client\Cms\AuditLogs\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($user_id = null, $event_type = null, $object_type = null, $object_id = null, $after = null, $before = null, $limit = null, $sort = null, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($user_id, $event_type, $object_type, $object_id, $after, $before, $limit, $sort, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\AuditLogs\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\AuditLogs\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Query audit logs - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($user_id = null, $event_type = null, $object_type = null, $object_id = null, $after = null, $before = null, $limit = null, $sort = null, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($user_id, $event_type, $object_type, $object_id, $after, $before, $limit, $sort, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Query audit logs - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($user_id = null, $event_type = null, $object_type = null, $object_id = null, $after = null, $before = null, $limit = null, $sort = null, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog'; - $request = $this->getPageRequest($user_id, $event_type, $object_type, $object_id, $after, $before, $limit, $sort, $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 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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($user_id = null, $event_type = null, $object_type = null, $object_id = null, $after = null, $before = null, $limit = null, $sort = null, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - - - - - $resourcePath = '/cms/v3/audit-logs/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $user_id, - 'userId', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $event_type, - 'eventType', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $object_type, - 'objectType', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $object_id, - 'objectId', // 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( - $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 - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sort, - 'sort', // param base name - 'array', // 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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/AuditLogs/Api/BasicApi.php b/codegen/Cms/AuditLogs/Api/BasicApi.php index a9f16f7a..32d21d63 100644 --- a/codegen/Cms/AuditLogs/Api/BasicApi.php +++ b/codegen/Cms/AuditLogs/Api/BasicApi.php @@ -469,7 +469,7 @@ public function cmsAuditLogsV3Request($after = null, $before = null, $event_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/BasicApi.php b/codegen/Cms/Blogs/Authors/Api/BasicApi.php index ec470305..f25ebf6b 100644 --- a/codegen/Cms/Blogs/Authors/Api/BasicApi.php +++ b/codegen/Cms/Blogs/Authors/Api/BasicApi.php @@ -348,7 +348,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -612,7 +612,7 @@ public function createRequest($blog_author, string $contentType = self::contentT if (isset($blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author; } @@ -633,7 +633,7 @@ public function createRequest($blog_author, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -949,7 +949,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1380,7 +1380,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1679,7 +1679,7 @@ public function updateRequest($object_id, $blog_author, $archived = null, string if (isset($blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author; } @@ -1700,7 +1700,7 @@ public function updateRequest($object_id, $blog_author, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/BatchApi.php b/codegen/Cms/Blogs/Authors/Api/BatchApi.php index 99a1fb32..e4fe6713 100644 --- a/codegen/Cms/Blogs/Authors/Api/BatchApi.php +++ b/codegen/Cms/Blogs/Authors/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createBatchRequest($batch_input_blog_author, string $contentType if (isset($batch_input_blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_author), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_blog_author; } @@ -628,7 +628,7 @@ public function createBatchRequest($batch_input_blog_author, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php b/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php deleted file mode 100644 index 6621db69..00000000 --- a/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php +++ /dev/null @@ -1,4190 +0,0 @@ - [ - 'application/json', - ], - 'archiveBatch' => [ - 'application/json', - ], - 'attachToLangGroup' => [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'createBatch' => [ - 'application/json', - ], - 'createLangVariation' => [ - 'application/json', - ], - 'detachFromLangGroup' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'readBatch' => [ - 'application/json', - ], - 'setLangPrimary' => [ - 'application/json', - ], - 'update' => [ - 'application/json', - ], - 'updateBatch' => [ - '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 archive - * - * Delete a Blog Author - * - * @param string $object_id The Blog Author id. (required) - * @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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_id, $archived, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a Blog Author - * - * @param string $object_id The Blog Author id. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a Blog Author - * - * @param string $object_id The Blog Author id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_id, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a Blog Author - * - * @param string $object_id The Blog Author id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_id, $archived, $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 $object_id The Blog Author id. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($object_id, $archived = null, string $contentType = self::contentTypes['archive'][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 archive' - ); - } - - - - $resourcePath = '/cms/v3/blogs/authors/{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 - 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( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation archiveBatch - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function archiveBatch($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $this->archiveBatchWithHttpInfo($batch_input_string, $contentType); - } - - /** - * Operation archiveBatchWithHttpInfo - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveBatchWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $request = $this->archiveBatchRequest($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\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveBatchAsync - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - return $this->archiveBatchAsyncWithHttpInfo($batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveBatchAsyncWithHttpInfo - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - $returnType = ''; - $request = $this->archiveBatchRequest($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 'archiveBatch' - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - - // 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 archiveBatch' - ); - } - - - $resourcePath = '/cms/v3/blogs/authors/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 attachToLangGroup - * - * Attach a Blog Author to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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 a Blog Author to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation attachToLangGroupAsync - * - * Attach a Blog Author to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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 a Blog Author to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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/authors/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 create - * - * Create a new Blog Author - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of a new Blog Author. (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\Authors\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error - */ - public function create($blog_author, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($blog_author, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a new Blog Author - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of a new Blog Author. (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\Authors\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\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($blog_author, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($blog_author, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a new Blog Author - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of a new Blog Author. (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($blog_author, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($blog_author, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a new Blog Author - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of a new Blog Author. (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($blog_author, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; - $request = $this->createRequest($blog_author, $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\Authors\Model\BlogAuthor $blog_author The JSON representation of a new Blog Author. (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($blog_author, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'blog_author' is set - if ($blog_author === null || (is_array($blog_author) && count($blog_author) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $blog_author when calling create' - ); - } - - - $resourcePath = '/cms/v3/blogs/authors'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($blog_author)) { - 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_author)); - } else { - $httpBody = $blog_author; - } - } 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 createBatch - * - * Create a batch of Blog Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputBlogAuthor $batch_input_blog_author The JSON array of new Blog Authors 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 - * - * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\Model\Error - */ - public function createBatch($batch_input_blog_author, string $contentType = self::contentTypes['createBatch'][0]) - { - list($response) = $this->createBatchWithHttpInfo($batch_input_blog_author, $contentType); - return $response; - } - - /** - * Operation createBatchWithHttpInfo - * - * Create a batch of Blog Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputBlogAuthor $batch_input_blog_author The JSON array of new Blog Authors 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 - * - * @throws \HubSpot\Client\Cms\Blogs\Authors\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\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createBatchWithHttpInfo($batch_input_blog_author, string $contentType = self::contentTypes['createBatch'][0]) - { - $request = $this->createBatchRequest($batch_input_blog_author, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createBatchAsync - * - * Create a batch of Blog Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputBlogAuthor $batch_input_blog_author The JSON array of new Blog Authors 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsync($batch_input_blog_author, string $contentType = self::contentTypes['createBatch'][0]) - { - return $this->createBatchAsyncWithHttpInfo($batch_input_blog_author, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createBatchAsyncWithHttpInfo - * - * Create a batch of Blog Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputBlogAuthor $batch_input_blog_author The JSON array of new Blog Authors 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsyncWithHttpInfo($batch_input_blog_author, string $contentType = self::contentTypes['createBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; - $request = $this->createBatchRequest($batch_input_blog_author, $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 'createBatch' - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputBlogAuthor $batch_input_blog_author The JSON array of new Blog Authors 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createBatchRequest($batch_input_blog_author, string $contentType = self::contentTypes['createBatch'][0]) - { - - // verify the required parameter 'batch_input_blog_author' is set - if ($batch_input_blog_author === null || (is_array($batch_input_blog_author) && count($batch_input_blog_author) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_blog_author when calling createBatch' - ); - } - - - $resourcePath = '/cms/v3/blogs/authors/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_author)) { - 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_author)); - } else { - $httpBody = $batch_input_blog_author; - } - } 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 new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthorCloneRequestVNext $blog_author_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Authors\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error - */ - public function createLangVariation($blog_author_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - list($response) = $this->createLangVariationWithHttpInfo($blog_author_clone_request_v_next, $contentType); - return $response; - } - - /** - * Operation createLangVariationWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthorCloneRequestVNext $blog_author_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Authors\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\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createLangVariationWithHttpInfo($blog_author_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $request = $this->createLangVariationRequest($blog_author_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createLangVariationAsync - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthorCloneRequestVNext $blog_author_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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_author_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - return $this->createLangVariationAsyncWithHttpInfo($blog_author_clone_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createLangVariationAsyncWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthorCloneRequestVNext $blog_author_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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_author_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; - $request = $this->createLangVariationRequest($blog_author_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\Authors\Model\BlogAuthorCloneRequestVNext $blog_author_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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_author_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - - // verify the required parameter 'blog_author_clone_request_v_next' is set - if ($blog_author_clone_request_v_next === null || (is_array($blog_author_clone_request_v_next) && count($blog_author_clone_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $blog_author_clone_request_v_next when calling createLangVariation' - ); - } - - - $resourcePath = '/cms/v3/blogs/authors/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_author_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_author_clone_request_v_next)); - } else { - $httpBody = $blog_author_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 a Blog Author from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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 a Blog Author from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation detachFromLangGroupAsync - * - * Detach a Blog Author from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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 a Blog Author from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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/authors/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 Author - * - * @param string $object_id The Blog Author id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string|null $property Used to specify which properties of the Blog Authors to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\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 Author - * - * @param string $object_id The Blog Author id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string|null $property Used to specify which properties of the Blog Authors to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve a Blog Author - * - * @param string $object_id The Blog Author id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string|null $property Used to specify which properties of the Blog Authors to include in the response. (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 Author - * - * @param string $object_id The Blog Author id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string|null $property Used to specify which properties of the Blog Authors to include in the response. (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\Authors\Model\BlogAuthor'; - $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 Author id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string|null $property Used to specify which properties of the Blog Authors to include in the response. (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/authors/{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 getPage - * - * Get all Blog Authors - * - * @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 Used to specify which properties of the Blog Authors to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging|\HubSpot\Client\Cms\Blogs\Authors\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 Authors - * - * @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 Used to specify which properties of the Blog Authors to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging|\HubSpot\Client\Cms\Blogs\Authors\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get all Blog Authors - * - * @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 Used to specify which properties of the Blog Authors to include in the response. (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 Authors - * - * @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 Used to specify which properties of the Blog Authors to include in the response. (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\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging'; - $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|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 Used to specify which properties of the Blog Authors to include in the response. (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/authors'; - $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 readBatch - * - * 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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\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 Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation readBatchAsync - * - * 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|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 - * @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 Authors - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readBatchAsyncWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; - $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\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @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 - * @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/authors/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 setLangPrimary - * - * Set a new primary language - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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\Authors\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\Authors\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\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation setLangPrimaryAsync - * - * Set a new primary language - * - * @param \HubSpot\Client\Cms\Blogs\Authors\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\Authors\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\Authors\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/authors/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 update - * - * Update a Blog Author - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error - */ - public function update($object_id, $blog_author, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_id, $blog_author, $archived, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a Blog Author - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_id, $blog_author, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_id, $blog_author, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a Blog Author - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsync($object_id, $blog_author, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_id, $blog_author, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a Blog Author - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsyncWithHttpInfo($object_id, $blog_author, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; - $request = $this->updateRequest($object_id, $blog_author, $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 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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateRequest($object_id, $blog_author, $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 update' - ); - } - - // verify the required parameter 'blog_author' is set - if ($blog_author === null || (is_array($blog_author) && count($blog_author) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $blog_author when calling update' - ); - } - - - - $resourcePath = '/cms/v3/blogs/authors/{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 - 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($blog_author)) { - 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_author)); - } else { - $httpBody = $blog_author; - } - } 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( - 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateBatch - * - * 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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\Model\Error - */ - public function updateBatch($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - list($response) = $this->updateBatchWithHttpInfo($batch_input_json_node, $archived, $contentType); - return $response; - } - - /** - * Operation updateBatchWithHttpInfo - * - * 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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor|\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors|\HubSpot\Client\Cms\Blogs\Authors\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $request = $this->updateBatchRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthorWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateBatchAsync - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsync($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - return $this->updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateBatchAsyncWithHttpInfo - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; - $request = $this->updateBatchRequest($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 '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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateBatchRequest($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][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 updateBatch' - ); - } - - - - $resourcePath = '/cms/v3/blogs/authors/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 - ); - } - - /** - * Operation updateLangs - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Authors\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\Authors\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Authors\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\Authors\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateLangsAsync - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Authors\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Authors\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Authors\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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/authors/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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php index 633cb0f0..415731f1 100644 --- a/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($blog_author_clone_request_v_next, st if (isset($blog_author_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($blog_author_clone_request_v_next, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php index 55213d8b..162163d9 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -936,7 +936,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2429,7 +2429,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2658,7 +2658,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2957,7 +2957,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -2978,7 +2978,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3262,7 +3262,7 @@ public function updateDraftRequest($object_id, $blog_post, string $contentType = if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -3283,7 +3283,7 @@ public function updateDraftRequest($object_id, $blog_post, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php index 86dc2841..c5892eb0 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveRequest($batch_input_string, string $contentType = self:: if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveRequest($batch_input_string, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createRequest($batch_input_blog_post, string $contentType = self 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_blog_post; } @@ -628,7 +628,7 @@ public function createRequest($batch_input_blog_post, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readRequest($batch_input_string, $archived = null, string $conte if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readRequest($batch_input_string, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateRequest($batch_input_json_node, $archived = null, string $ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateRequest($batch_input_json_node, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php index e4dc1e6f..73f52eb1 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n 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 = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post_language_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post_language_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php b/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php index ea180b76..cc3d79b6 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php @@ -406,7 +406,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -737,7 +737,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1043,7 +1043,7 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1349,7 +1349,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php deleted file mode 100644 index 3c208f56..00000000 --- a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class CollectionResponseWithTotalVersionBlogPost implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalVersionBlogPost'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Paging', - 'results' => '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Cms\Blogs\BlogPosts\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\Paging|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\Cms\Blogs\BlogPosts\Model\VersionBlogPost[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost[] $results Collection of blog post versions. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of blog post versions. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Blogs/Tags/Api/BasicApi.php b/codegen/Cms/Blogs/Tags/Api/BasicApi.php index 7e13ee1e..c014011a 100644 --- a/codegen/Cms/Blogs/Tags/Api/BasicApi.php +++ b/codegen/Cms/Blogs/Tags/Api/BasicApi.php @@ -348,7 +348,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -612,7 +612,7 @@ public function createRequest($tag, string $contentType = self::contentTypes['cr if (isset($tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $tag; } @@ -633,7 +633,7 @@ public function createRequest($tag, string $contentType = self::contentTypes['cr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -949,7 +949,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1380,7 +1380,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1679,7 +1679,7 @@ public function updateRequest($object_id, $tag, $archived = null, string $conten if (isset($tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $tag; } @@ -1700,7 +1700,7 @@ public function updateRequest($object_id, $tag, $archived = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Tags/Api/BatchApi.php b/codegen/Cms/Blogs/Tags/Api/BatchApi.php index baec9de6..2131f517 100644 --- a/codegen/Cms/Blogs/Tags/Api/BatchApi.php +++ b/codegen/Cms/Blogs/Tags/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createBatchRequest($batch_input_tag, string $contentType = self: if (isset($batch_input_tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_tag), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_tag; } @@ -628,7 +628,7 @@ public function createBatchRequest($batch_input_tag, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php b/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php deleted file mode 100644 index 7a993eab..00000000 --- a/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php +++ /dev/null @@ -1,4190 +0,0 @@ - [ - 'application/json', - ], - 'archiveBatch' => [ - 'application/json', - ], - 'attachToLangGroup' => [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'createBatch' => [ - 'application/json', - ], - 'createLangVariation' => [ - 'application/json', - ], - 'detachFromLangGroup' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'readBatch' => [ - 'application/json', - ], - 'setLangPrimary' => [ - 'application/json', - ], - 'update' => [ - 'application/json', - ], - 'updateBatch' => [ - '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 archive - * - * Delete a Blog Tag - * - * @param string $object_id The Blog Tag id. (required) - * @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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_id, $archived, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a Blog Tag - * - * @param string $object_id The Blog Tag id. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a Blog Tag - * - * @param string $object_id The Blog Tag id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_id, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a Blog Tag - * - * @param string $object_id The Blog Tag id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_id, $archived, $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 $object_id The Blog Tag id. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($object_id, $archived = null, string $contentType = self::contentTypes['archive'][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 archive' - ); - } - - - - $resourcePath = '/cms/v3/blogs/tags/{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 - 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( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation archiveBatch - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function archiveBatch($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $this->archiveBatchWithHttpInfo($batch_input_string, $contentType); - } - - /** - * Operation archiveBatchWithHttpInfo - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveBatchWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $request = $this->archiveBatchRequest($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\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveBatchAsync - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - return $this->archiveBatchAsyncWithHttpInfo($batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveBatchAsyncWithHttpInfo - * - * Delete 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 string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - $returnType = ''; - $request = $this->archiveBatchRequest($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 'archiveBatch' - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - - // 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 archiveBatch' - ); - } - - - $resourcePath = '/cms/v3/blogs/tags/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 attachToLangGroup - * - * Attach a Blog Tag to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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 a Blog Tag to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation attachToLangGroupAsync - * - * Attach a Blog Tag to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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 a Blog Tag to a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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/tags/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 create - * - * Create a new Blog Tag - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of a new Blog Tag. (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\Tags\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error - */ - public function create($tag, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($tag, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a new Blog Tag - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of a new Blog Tag. (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\Tags\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\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($tag, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($tag, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a new Blog Tag - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of a new Blog Tag. (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($tag, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($tag, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a new Blog Tag - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of a new Blog Tag. (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($tag, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; - $request = $this->createRequest($tag, $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\Tags\Model\Tag $tag The JSON representation of a new Blog Tag. (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($tag, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'tag' is set - if ($tag === null || (is_array($tag) && count($tag) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $tag when calling create' - ); - } - - - $resourcePath = '/cms/v3/blogs/tags'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($tag)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tag)); - } else { - $httpBody = $tag; - } - } 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 createBatch - * - * Create a batch of Blog Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputTag $batch_input_tag The JSON array of new Blog Tags 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 - * - * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\Model\Error - */ - public function createBatch($batch_input_tag, string $contentType = self::contentTypes['createBatch'][0]) - { - list($response) = $this->createBatchWithHttpInfo($batch_input_tag, $contentType); - return $response; - } - - /** - * Operation createBatchWithHttpInfo - * - * Create a batch of Blog Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputTag $batch_input_tag The JSON array of new Blog Tags 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 - * - * @throws \HubSpot\Client\Cms\Blogs\Tags\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\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createBatchWithHttpInfo($batch_input_tag, string $contentType = self::contentTypes['createBatch'][0]) - { - $request = $this->createBatchRequest($batch_input_tag, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createBatchAsync - * - * Create a batch of Blog Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputTag $batch_input_tag The JSON array of new Blog Tags 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsync($batch_input_tag, string $contentType = self::contentTypes['createBatch'][0]) - { - return $this->createBatchAsyncWithHttpInfo($batch_input_tag, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createBatchAsyncWithHttpInfo - * - * Create a batch of Blog Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputTag $batch_input_tag The JSON array of new Blog Tags 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsyncWithHttpInfo($batch_input_tag, string $contentType = self::contentTypes['createBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; - $request = $this->createBatchRequest($batch_input_tag, $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 'createBatch' - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputTag $batch_input_tag The JSON array of new Blog Tags 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createBatchRequest($batch_input_tag, string $contentType = self::contentTypes['createBatch'][0]) - { - - // verify the required parameter 'batch_input_tag' is set - if ($batch_input_tag === null || (is_array($batch_input_tag) && count($batch_input_tag) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_tag when calling createBatch' - ); - } - - - $resourcePath = '/cms/v3/blogs/tags/batch/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_tag)) { - 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_tag)); - } else { - $httpBody = $batch_input_tag; - } - } 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 new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\TagCloneRequestVNext $tag_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Tags\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error - */ - public function createLangVariation($tag_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - list($response) = $this->createLangVariationWithHttpInfo($tag_clone_request_v_next, $contentType); - return $response; - } - - /** - * Operation createLangVariationWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\TagCloneRequestVNext $tag_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Tags\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\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createLangVariationWithHttpInfo($tag_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $request = $this->createLangVariationRequest($tag_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createLangVariationAsync - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\TagCloneRequestVNext $tag_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($tag_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - return $this->createLangVariationAsyncWithHttpInfo($tag_clone_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createLangVariationAsyncWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\TagCloneRequestVNext $tag_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($tag_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; - $request = $this->createLangVariationRequest($tag_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\Tags\Model\TagCloneRequestVNext $tag_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($tag_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - - // verify the required parameter 'tag_clone_request_v_next' is set - if ($tag_clone_request_v_next === null || (is_array($tag_clone_request_v_next) && count($tag_clone_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $tag_clone_request_v_next when calling createLangVariation' - ); - } - - - $resourcePath = '/cms/v3/blogs/tags/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($tag_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($tag_clone_request_v_next)); - } else { - $httpBody = $tag_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 a Blog Tag from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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 a Blog Tag from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation detachFromLangGroupAsync - * - * Detach a Blog Tag from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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 a Blog Tag from a multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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/tags/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 Tag - * - * @param string $object_id The Blog Tag id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the Blog Tag to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\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 Tag - * - * @param string $object_id The Blog Tag id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the Blog Tag to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve a Blog Tag - * - * @param string $object_id The Blog Tag id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the Blog Tag to include in the response. (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 Tag - * - * @param string $object_id The Blog Tag id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the Blog Tag to include in the response. (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\Tags\Model\Tag'; - $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 Tag id. (required) - * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the Blog Tag to include in the response. (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/tags/{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 getPage - * - * Get all Blog Tags - * - * @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 Specifies which properties of the Blog Tag to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging|\HubSpot\Client\Cms\Blogs\Tags\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 Tags - * - * @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 Specifies which properties of the Blog Tag to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging|\HubSpot\Client\Cms\Blogs\Tags\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get all Blog Tags - * - * @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 Specifies which properties of the Blog Tag to include in the response. (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 Tags - * - * @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 Specifies which properties of the Blog Tag to include in the response. (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\Tags\Model\CollectionResponseWithTotalTagForwardPaging'; - $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|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 Specifies which properties of the Blog Tag to include in the response. (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/tags'; - $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 readBatch - * - * 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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\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 Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation readBatchAsync - * - * 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|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 - * @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 Tags - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readBatchAsyncWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; - $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\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @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 - * @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/tags/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 setLangPrimary - * - * Set a new primary language - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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\Tags\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\Tags\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\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation setLangPrimaryAsync - * - * Set a new primary language - * - * @param \HubSpot\Client\Cms\Blogs\Tags\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\Tags\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\Tags\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/tags/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 update - * - * Update a Blog Tag - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error - */ - public function update($object_id, $tag, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_id, $tag, $archived, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a Blog Tag - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Tags\Model\Tag|\HubSpot\Client\Cms\Blogs\Tags\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_id, $tag, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_id, $tag, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a Blog Tag - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsync($object_id, $tag, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_id, $tag, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a Blog Tag - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsyncWithHttpInfo($object_id, $tag, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; - $request = $this->updateRequest($object_id, $tag, $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 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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateRequest($object_id, $tag, $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 update' - ); - } - - // verify the required parameter 'tag' is set - if ($tag === null || (is_array($tag) && count($tag) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $tag when calling update' - ); - } - - - - $resourcePath = '/cms/v3/blogs/tags/{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 - 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($tag)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tag)); - } else { - $httpBody = $tag; - } - } 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( - 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateBatch - * - * 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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\Model\Error - */ - public function updateBatch($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - list($response) = $this->updateBatchWithHttpInfo($batch_input_json_node, $archived, $contentType); - return $response; - } - - /** - * Operation updateBatchWithHttpInfo - * - * 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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag|\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors|\HubSpot\Client\Cms\Blogs\Tags\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $request = $this->updateBatchRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTagWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateBatchAsync - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsync($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - return $this->updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateBatchAsyncWithHttpInfo - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; - $request = $this->updateBatchRequest($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 '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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateBatchRequest($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][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 updateBatch' - ); - } - - - - $resourcePath = '/cms/v3/blogs/tags/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 - ); - } - - /** - * Operation updateLangs - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Tags\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\Tags\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Tags\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\Tags\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateLangsAsync - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Blogs\Tags\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Tags\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Tags\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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/tags/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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php index 4791f64a..eace0931 100644 --- a/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($tag_clone_request_v_next, string $co if (isset($tag_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $tag_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($tag_clone_request_v_next, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Domains/Api/BasicApi.php b/codegen/Cms/Domains/Api/BasicApi.php index e3cd5f90..b31ab253 100644 --- a/codegen/Cms/Domains/Api/BasicApi.php +++ b/codegen/Cms/Domains/Api/BasicApi.php @@ -502,7 +502,7 @@ public function cmsV3DomainsRequest($after = null, $archived = null, $created_af } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -788,7 +788,7 @@ public function getByIdRequest($domain_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Domains/Api/DomainsApi.php b/codegen/Cms/Domains/Api/DomainsApi.php deleted file mode 100644 index 2f4df983..00000000 --- a/codegen/Cms/Domains/Api/DomainsApi.php +++ /dev/null @@ -1,902 +0,0 @@ - [ - 'application/json', - ], - 'getPage' => [ - '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 getById - * - * Get a single domain - * - * @param string $domain_id The unique ID of the domain. (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\Cms\Domains\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Domains\Model\Domain|\HubSpot\Client\Cms\Domains\Model\Error - */ - public function getById($domain_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($domain_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get a single domain - * - * @param string $domain_id The unique ID of the domain. (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\Cms\Domains\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Domains\Model\Domain|\HubSpot\Client\Cms\Domains\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($domain_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($domain_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\Domain', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\Domain', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Domains\Model\Domain', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Domains\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get a single domain - * - * @param string $domain_id The unique ID of the domain. (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($domain_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($domain_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get a single domain - * - * @param string $domain_id The unique ID of the domain. (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($domain_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Cms\Domains\Model\Domain'; - $request = $this->getByIdRequest($domain_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 string $domain_id The unique ID of the domain. (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($domain_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'domain_id' is set - if ($domain_id === null || (is_array($domain_id) && count($domain_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $domain_id when calling getById' - ); - } - - - $resourcePath = '/cms/v3/domains/{domainId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($domain_id !== null) { - $resourcePath = str_replace( - '{' . 'domainId' . '}', - ObjectSerializer::toPathValue($domain_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 current domains - * - * @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 Specifies the order in which the domains are returned. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging|\HubSpot\Client\Cms\Domains\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, 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, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get current domains - * - * @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 Specifies the order in which the domains are returned. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging|\HubSpot\Client\Cms\Domains\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, 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, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Domains\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get current domains - * - * @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 Specifies the order in which the domains are returned. (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 - * @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, 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, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get current domains - * - * @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 Specifies the order in which the domains are returned. (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 - * @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, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging'; - $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $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 'getPage' - * - * @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 Specifies the order in which the domains are returned. (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 - * @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, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - - - - - - - $resourcePath = '/cms/v3/domains/'; - $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 - ) ?? []); - - - - - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php b/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php deleted file mode 100644 index 9863da06..00000000 --- a/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php +++ /dev/null @@ -1,483 +0,0 @@ - - */ -class CollectionResponseWithTotalDomainForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalDomainForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Cms\Domains\Model\ForwardPaging', - 'results' => '\HubSpot\Client\Cms\Domains\Model\Domain[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Cms\Domains\Model\ForwardPaging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Cms\Domains\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\Cms\Domains\Model\Domain[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\Domains\Model\Domain[] $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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total The total number of domains returned in the response. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Domains/Model/ForwardPaging.php b/codegen/Cms/Domains/Model/ForwardPaging.php deleted file mode 100644 index 4f9ca4f6..00000000 --- a/codegen/Cms/Domains/Model/ForwardPaging.php +++ /dev/null @@ -1,409 +0,0 @@ - - */ -class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\HubSpot\Client\Cms\Domains\Model\NextPage' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => 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 = [ - 'next' => 'next' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext' - ]; - - /** - * 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('next', $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 next - * - * @return \HubSpot\Client\Cms\Domains\Model\NextPage|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \HubSpot\Client\Cms\Domains\Model\NextPage|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Hubdb/Api/RowsApi.php b/codegen/Cms/Hubdb/Api/RowsApi.php index 133f1b13..069a184a 100644 --- a/codegen/Cms/Hubdb/Api/RowsApi.php +++ b/codegen/Cms/Hubdb/Api/RowsApi.php @@ -457,7 +457,7 @@ public function cloneDraftTableRowRequest($row_id, $table_id_or_name, $name = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -741,7 +741,7 @@ public function cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_d if (isset($batch_input_hub_db_table_row_batch_clone_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_batch_clone_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_batch_clone_request; } @@ -762,7 +762,7 @@ public function cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_d } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1060,7 +1060,7 @@ public function createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ if (isset($batch_input_hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_request; } @@ -1081,7 +1081,7 @@ public function createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1365,7 +1365,7 @@ public function createTableRowRequest($table_id_or_name, $hub_db_table_row_v3_re if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -1386,7 +1386,7 @@ public function createTableRowRequest($table_id_or_name, $hub_db_table_row_v3_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1710,7 +1710,7 @@ public function getDraftTableRowByIdRequest($row_id, $table_id_or_name, $archive } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2034,7 +2034,7 @@ public function getTableRowRequest($row_id, $table_id_or_name, $archived = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2410,7 +2410,7 @@ public function getTableRowsRequest($table_id_or_name, $after = null, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2663,7 +2663,7 @@ public function purgeDraftTableRowRequest($row_id, $table_id_or_name, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2891,7 +2891,7 @@ public function purgeDraftTableRowsRequest($table_id_or_name, $batch_input_strin if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2912,7 +2912,7 @@ public function purgeDraftTableRowsRequest($table_id_or_name, $batch_input_strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3210,7 +3210,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $batch_input_string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -3231,7 +3231,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $batch_input_string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3529,7 +3529,7 @@ public function readTableRowsRequest($table_id_or_name, $batch_input_string, str if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -3550,7 +3550,7 @@ public function readTableRowsRequest($table_id_or_name, $batch_input_string, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3857,7 +3857,7 @@ public function replaceDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_ if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -3878,7 +3878,7 @@ public function replaceDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4176,7 +4176,7 @@ public function replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub if (isset($batch_input_hub_db_table_row_v3_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_batch_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_batch_update_request; } @@ -4197,7 +4197,7 @@ public function replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4504,7 +4504,7 @@ public function updateDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_t if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -4525,7 +4525,7 @@ public function updateDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_t } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4823,7 +4823,7 @@ public function updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ if (isset($batch_input_hub_db_table_row_v3_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_batch_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_batch_update_request; } @@ -4844,7 +4844,7 @@ public function updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Hubdb/Api/RowsBatchApi.php b/codegen/Cms/Hubdb/Api/RowsBatchApi.php deleted file mode 100644 index d7953dc4..00000000 --- a/codegen/Cms/Hubdb/Api/RowsBatchApi.php +++ /dev/null @@ -1,2364 +0,0 @@ - [ - 'application/json', - ], - 'createDraftTableRows' => [ - 'application/json', - ], - 'purgeDraftTableRows' => [ - 'application/json', - ], - 'readDraftTableRows' => [ - 'application/json', - ], - 'readTableRows' => [ - 'application/json', - ], - 'replaceDraftTableRows' => [ - 'application/json', - ], - 'updateDraftTableRows' => [ - '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 cloneDraftTableRows - * - * Clone rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowBatchCloneRequest $batch_input_hub_db_table_row_batch_clone_request batch_input_hub_db_table_row_batch_clone_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function cloneDraftTableRows($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, string $contentType = self::contentTypes['cloneDraftTableRows'][0]) - { - list($response) = $this->cloneDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, $contentType); - return $response; - } - - /** - * Operation cloneDraftTableRowsWithHttpInfo - * - * Clone rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowBatchCloneRequest $batch_input_hub_db_table_row_batch_clone_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function cloneDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, string $contentType = self::contentTypes['cloneDraftTableRows'][0]) - { - $request = $this->cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cloneDraftTableRowsAsync - * - * Clone rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowBatchCloneRequest $batch_input_hub_db_table_row_batch_clone_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cloneDraftTableRowsAsync($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, string $contentType = self::contentTypes['cloneDraftTableRows'][0]) - { - return $this->cloneDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cloneDraftTableRowsAsyncWithHttpInfo - * - * Clone rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowBatchCloneRequest $batch_input_hub_db_table_row_batch_clone_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cloneDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, string $contentType = self::contentTypes['cloneDraftTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_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 'cloneDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowBatchCloneRequest $batch_input_hub_db_table_row_batch_clone_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_batch_clone_request, string $contentType = self::contentTypes['cloneDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling cloneDraftTableRows' - ); - } - - // verify the required parameter 'batch_input_hub_db_table_row_batch_clone_request' is set - if ($batch_input_hub_db_table_row_batch_clone_request === null || (is_array($batch_input_hub_db_table_row_batch_clone_request) && count($batch_input_hub_db_table_row_batch_clone_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_hub_db_table_row_batch_clone_request when calling cloneDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/clone'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_hub_db_table_row_batch_clone_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_hub_db_table_row_batch_clone_request)); - } else { - $httpBody = $batch_input_hub_db_table_row_batch_clone_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 createDraftTableRows - * - * Create rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3Request $batch_input_hub_db_table_row_v3_request batch_input_hub_db_table_row_v3_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function createDraftTableRows($table_id_or_name, $batch_input_hub_db_table_row_v3_request, string $contentType = self::contentTypes['createDraftTableRows'][0]) - { - list($response) = $this->createDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_request, $contentType); - return $response; - } - - /** - * Operation createDraftTableRowsWithHttpInfo - * - * Create rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3Request $batch_input_hub_db_table_row_v3_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_request, string $contentType = self::contentTypes['createDraftTableRows'][0]) - { - $request = $this->createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createDraftTableRowsAsync - * - * Create rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3Request $batch_input_hub_db_table_row_v3_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createDraftTableRowsAsync($table_id_or_name, $batch_input_hub_db_table_row_v3_request, string $contentType = self::contentTypes['createDraftTableRows'][0]) - { - return $this->createDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createDraftTableRowsAsyncWithHttpInfo - * - * Create rows in batch - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3Request $batch_input_hub_db_table_row_v3_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_request, string $contentType = self::contentTypes['createDraftTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_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 'createDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3Request $batch_input_hub_db_table_row_v3_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_request, string $contentType = self::contentTypes['createDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling createDraftTableRows' - ); - } - - // verify the required parameter 'batch_input_hub_db_table_row_v3_request' is set - if ($batch_input_hub_db_table_row_v3_request === null || (is_array($batch_input_hub_db_table_row_v3_request) && count($batch_input_hub_db_table_row_v3_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_hub_db_table_row_v3_request when calling createDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_hub_db_table_row_v3_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_hub_db_table_row_v3_request)); - } else { - $httpBody = $batch_input_hub_db_table_row_v3_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 purgeDraftTableRows - * - * Permanently deletes rows - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purgeDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function purgeDraftTableRows($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['purgeDraftTableRows'][0]) - { - $this->purgeDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, $contentType); - } - - /** - * Operation purgeDraftTableRowsWithHttpInfo - * - * Permanently deletes rows - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purgeDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function purgeDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['purgeDraftTableRows'][0]) - { - $request = $this->purgeDraftTableRowsRequest($table_id_or_name, $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\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation purgeDraftTableRowsAsync - * - * Permanently deletes rows - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purgeDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeDraftTableRowsAsync($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['purgeDraftTableRows'][0]) - { - return $this->purgeDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation purgeDraftTableRowsAsyncWithHttpInfo - * - * Permanently deletes rows - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purgeDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['purgeDraftTableRows'][0]) - { - $returnType = ''; - $request = $this->purgeDraftTableRowsRequest($table_id_or_name, $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 'purgeDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purgeDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function purgeDraftTableRowsRequest($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['purgeDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling purgeDraftTableRows' - ); - } - - // 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 purgeDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/purge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $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 readDraftTableRows - * - * Get a set of rows from draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string batch_input_string (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function readDraftTableRows($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readDraftTableRows'][0]) - { - list($response) = $this->readDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, $contentType); - return $response; - } - - /** - * Operation readDraftTableRowsWithHttpInfo - * - * Get a set of rows from draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function readDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readDraftTableRows'][0]) - { - $request = $this->readDraftTableRowsRequest($table_id_or_name, $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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation readDraftTableRowsAsync - * - * Get a set of rows from draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readDraftTableRowsAsync($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readDraftTableRows'][0]) - { - return $this->readDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation readDraftTableRowsAsyncWithHttpInfo - * - * Get a set of rows from draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readDraftTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->readDraftTableRowsRequest($table_id_or_name, $batch_input_string, $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 'readDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function readDraftTableRowsRequest($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling readDraftTableRows' - ); - } - - // 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 readDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/read'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $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 readTableRows - * - * Get a set of rows - * - * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readTableRows'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function readTableRows($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readTableRows'][0]) - { - list($response) = $this->readTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, $contentType); - return $response; - } - - /** - * Operation readTableRowsWithHttpInfo - * - * Get a set of rows - * - * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function readTableRowsWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readTableRows'][0]) - { - $request = $this->readTableRowsRequest($table_id_or_name, $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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation readTableRowsAsync - * - * Get a set of rows - * - * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readTableRowsAsync($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readTableRows'][0]) - { - return $this->readTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation readTableRowsAsyncWithHttpInfo - * - * Get a set of rows - * - * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->readTableRowsRequest($table_id_or_name, $batch_input_string, $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 'readTableRows' - * - * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputString $batch_input_string (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function readTableRowsRequest($table_id_or_name, $batch_input_string, string $contentType = self::contentTypes['readTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling readTableRows' - ); - } - - // 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 readTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/batch/read'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $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 replaceDraftTableRows - * - * Replace rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function replaceDraftTableRows($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['replaceDraftTableRows'][0]) - { - list($response) = $this->replaceDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, $contentType); - return $response; - } - - /** - * Operation replaceDraftTableRowsWithHttpInfo - * - * Replace rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function replaceDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['replaceDraftTableRows'][0]) - { - $request = $this->replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation replaceDraftTableRowsAsync - * - * Replace rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceDraftTableRowsAsync($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['replaceDraftTableRows'][0]) - { - return $this->replaceDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation replaceDraftTableRowsAsyncWithHttpInfo - * - * Replace rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['replaceDraftTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_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 'replaceDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['replaceDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling replaceDraftTableRows' - ); - } - - // verify the required parameter 'batch_input_hub_db_table_row_v3_batch_update_request' is set - if ($batch_input_hub_db_table_row_v3_batch_update_request === null || (is_array($batch_input_hub_db_table_row_v3_batch_update_request) && count($batch_input_hub_db_table_row_v3_batch_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_hub_db_table_row_v3_batch_update_request when calling replaceDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/replace'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_hub_db_table_row_v3_batch_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_hub_db_table_row_v3_batch_update_request)); - } else { - $httpBody = $batch_input_hub_db_table_row_v3_batch_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 updateDraftTableRows - * - * Update rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error - */ - public function updateDraftTableRows($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['updateDraftTableRows'][0]) - { - list($response) = $this->updateDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, $contentType); - return $response; - } - - /** - * Operation updateDraftTableRowsWithHttpInfo - * - * Update rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTableRows'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3|\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors|\HubSpot\Client\Cms\Hubdb\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['updateDraftTableRows'][0]) - { - $request = $this->updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3WithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Hubdb\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateDraftTableRowsAsync - * - * Update rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateDraftTableRowsAsync($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['updateDraftTableRows'][0]) - { - return $this->updateDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateDraftTableRowsAsyncWithHttpInfo - * - * Update rows in batch in draft table - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateDraftTableRowsAsyncWithHttpInfo($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['updateDraftTableRows'][0]) - { - $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; - $request = $this->updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_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 'updateDraftTableRows' - * - * @param string $table_id_or_name The ID or name of the table (required) - * @param \HubSpot\Client\Cms\Hubdb\Model\BatchInputHubDbTableRowV3BatchUpdateRequest $batch_input_hub_db_table_row_v3_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTableRows'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_db_table_row_v3_batch_update_request, string $contentType = self::contentTypes['updateDraftTableRows'][0]) - { - - // verify the required parameter 'table_id_or_name' is set - if ($table_id_or_name === null || (is_array($table_id_or_name) && count($table_id_or_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $table_id_or_name when calling updateDraftTableRows' - ); - } - - // verify the required parameter 'batch_input_hub_db_table_row_v3_batch_update_request' is set - if ($batch_input_hub_db_table_row_v3_batch_update_request === null || (is_array($batch_input_hub_db_table_row_v3_batch_update_request) && count($batch_input_hub_db_table_row_v3_batch_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_hub_db_table_row_v3_batch_update_request when calling updateDraftTableRows' - ); - } - - - $resourcePath = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/update'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($table_id_or_name !== null) { - $resourcePath = str_replace( - '{' . 'tableIdOrName' . '}', - ObjectSerializer::toPathValue($table_id_or_name), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_hub_db_table_row_v3_batch_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_hub_db_table_row_v3_batch_update_request)); - } else { - $httpBody = $batch_input_hub_db_table_row_v3_batch_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/Hubdb/Api/TablesApi.php b/codegen/Cms/Hubdb/Api/TablesApi.php index c079c632..f61e7f66 100644 --- a/codegen/Cms/Hubdb/Api/TablesApi.php +++ b/codegen/Cms/Hubdb/Api/TablesApi.php @@ -366,7 +366,7 @@ public function archiveTableRequest($table_id_or_name, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -650,7 +650,7 @@ public function cloneDraftTableRequest($table_id_or_name, $hub_db_table_clone_re if (isset($hub_db_table_clone_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_clone_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_clone_request; } @@ -671,7 +671,7 @@ public function cloneDraftTableRequest($table_id_or_name, $hub_db_table_clone_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -935,7 +935,7 @@ public function createTableRequest($hub_db_table_v3_request, string $contentType if (isset($hub_db_table_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_v3_request; } @@ -956,7 +956,7 @@ public function createTableRequest($hub_db_table_v3_request, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1257,7 +1257,7 @@ public function exportDraftTableRequest($table_id_or_name, $format = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1558,7 +1558,7 @@ public function exportTableRequest($table_id_or_name, $format = null, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2004,7 +2004,7 @@ public function getAllDraftTablesRequest($after = null, $archived = null, $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2450,7 +2450,7 @@ public function getAllTablesRequest($after = null, $archived = null, $content_ty } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2781,7 +2781,7 @@ public function getDraftTableDetailsByIdRequest($table_id_or_name, $archived = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3112,7 +3112,7 @@ public function getTableDetailsRequest($table_id_or_name, $archived = null, $inc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3421,7 +3421,7 @@ public function importDraftTableRequest($table_id_or_name, $config = null, $file } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3722,7 +3722,7 @@ public function publishDraftTableRequest($table_id_or_name, $include_foreign_ids } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4098,7 +4098,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $after = null, $arc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4351,7 +4351,7 @@ public function removeTableVersionRequest($table_id_or_name, $version_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4652,7 +4652,7 @@ public function resetDraftTableRequest($table_id_or_name, $include_foreign_ids = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4953,7 +4953,7 @@ public function unpublishTableRequest($table_id_or_name, $include_foreign_ids = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5282,7 +5282,7 @@ public function updateDraftTableRequest($table_id_or_name, $hub_db_table_v3_requ if (isset($hub_db_table_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_v3_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_v3_request; } @@ -5303,7 +5303,7 @@ public function updateDraftTableRequest($table_id_or_name, $hub_db_table_v3_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php b/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php deleted file mode 100644 index 7ea3855f..00000000 --- a/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php +++ /dev/null @@ -1,483 +0,0 @@ - - */ -class CollectionResponseWithTotalHubDbTableV3ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalHubDbTableV3ForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Cms\Hubdb\Model\ForwardPaging', - 'results' => '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Cms\Hubdb\Model\ForwardPaging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Cms\Hubdb\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\Cms\Hubdb\Model\HubDbTableV3[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3[] $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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total The total number of tables available in the collection. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Hubdb/Model/ForwardPaging.php b/codegen/Cms/Hubdb/Model/ForwardPaging.php deleted file mode 100644 index c1be1dd4..00000000 --- a/codegen/Cms/Hubdb/Model/ForwardPaging.php +++ /dev/null @@ -1,409 +0,0 @@ - - */ -class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\HubSpot\Client\Cms\Hubdb\Model\NextPage' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => 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 = [ - 'next' => 'next' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext' - ]; - - /** - * 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('next', $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 next - * - * @return \HubSpot\Client\Cms\Hubdb\Model\NextPage|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \HubSpot\Client\Cms\Hubdb\Model\NextPage|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Pages/Api/ABTestsApi.php b/codegen/Cms/Pages/Api/ABTestsApi.php index f06caad0..6e9702a6 100644 --- a/codegen/Cms/Pages/Api/ABTestsApi.php +++ b/codegen/Cms/Pages/Api/ABTestsApi.php @@ -370,7 +370,7 @@ public function createABTestVariationRequest($ab_test_create_request_v_next, str if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -391,7 +391,7 @@ public function createABTestVariationRequest($ab_test_create_request_v_next, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -655,7 +655,7 @@ public function createABTestVariation_0Request($ab_test_create_request_v_next, s if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -676,7 +676,7 @@ public function createABTestVariation_0Request($ab_test_create_request_v_next, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -884,7 +884,7 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont if (isset($ab_test_end_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_end_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_end_request_v_next; } @@ -905,7 +905,7 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1113,7 +1113,7 @@ public function endActiveABTest_0Request($ab_test_end_request_v_next, string $co if (isset($ab_test_end_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_end_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_end_request_v_next; } @@ -1134,7 +1134,7 @@ public function endActiveABTest_0Request($ab_test_end_request_v_next, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1342,7 +1342,7 @@ public function rerunPreviousABTestRequest($ab_test_rerun_request_v_next, string if (isset($ab_test_rerun_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_rerun_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_rerun_request_v_next; } @@ -1363,7 +1363,7 @@ public function rerunPreviousABTestRequest($ab_test_rerun_request_v_next, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1571,7 +1571,7 @@ public function rerunPreviousABTest_0Request($ab_test_rerun_request_v_next, stri if (isset($ab_test_rerun_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_rerun_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_rerun_request_v_next; } @@ -1592,7 +1592,7 @@ public function rerunPreviousABTest_0Request($ab_test_rerun_request_v_next, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/AdvancedApi.php b/codegen/Cms/Pages/Api/AdvancedApi.php index 01fc91c2..7d0c437a 100644 --- a/codegen/Cms/Pages/Api/AdvancedApi.php +++ b/codegen/Cms/Pages/Api/AdvancedApi.php @@ -409,7 +409,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -740,7 +740,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1046,7 +1046,7 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1352,7 +1352,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1658,7 +1658,7 @@ public function restorePreviousVersion_0Request($object_id, $revision_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/BasicApi.php b/codegen/Cms/Pages/Api/BasicApi.php index 2a3e67ab..5cb254be 100644 --- a/codegen/Cms/Pages/Api/BasicApi.php +++ b/codegen/Cms/Pages/Api/BasicApi.php @@ -541,7 +541,7 @@ public function cmsPagesV3LandingPagesCursorRequest($after = null, $archived = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -964,7 +964,7 @@ public function cmsPagesV3LandingPagesCursorQueryRequest($after = null, $archive } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1387,7 +1387,7 @@ public function cmsPagesV3LandingPagesFoldersCursorRequest($after = null, $archi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1810,7 +1810,7 @@ public function cmsPagesV3LandingPagesFoldersCursorQueryRequest($after = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2233,7 +2233,7 @@ public function cmsPagesV3SitePagesCursorRequest($after = null, $archived = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2656,7 +2656,7 @@ public function cmsPagesV3SitePagesCursorQueryRequest($after = null, $archived = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2962,7 +2962,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3293,7 +3293,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3523,7 +3523,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3829,7 +3829,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/BatchApi.php b/codegen/Cms/Pages/Api/BatchApi.php index 48338076..090c22b4 100644 --- a/codegen/Cms/Pages/Api/BatchApi.php +++ b/codegen/Cms/Pages/Api/BatchApi.php @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -350,7 +350,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -558,7 +558,7 @@ public function archiveBatch_0Request($batch_input_string, string $contentType = if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -579,7 +579,7 @@ public function archiveBatch_0Request($batch_input_string, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -787,7 +787,7 @@ public function archiveFoldersRequest($batch_input_string, string $contentType = if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -808,7 +808,7 @@ public function archiveFoldersRequest($batch_input_string, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1086,7 +1086,7 @@ public function createBatchRequest($batch_input_page, string $contentType = self if (isset($batch_input_page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_page; } @@ -1107,7 +1107,7 @@ public function createBatchRequest($batch_input_page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1385,7 +1385,7 @@ public function createBatch_0Request($batch_input_page, string $contentType = se if (isset($batch_input_page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_page; } @@ -1406,7 +1406,7 @@ public function createBatch_0Request($batch_input_page, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1684,7 +1684,7 @@ public function createFoldersRequest($batch_input_content_folder, string $conten if (isset($batch_input_content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_content_folder), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_content_folder; } @@ -1705,7 +1705,7 @@ public function createFoldersRequest($batch_input_content_folder, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1998,7 +1998,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2019,7 +2019,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2312,7 +2312,7 @@ public function readBatch_0Request($batch_input_string, $archived = null, string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2333,7 +2333,7 @@ public function readBatch_0Request($batch_input_string, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2626,7 +2626,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -2647,7 +2647,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2940,7 +2940,7 @@ public function updateBatch_0Request($batch_input_json_node, $archived = null, s 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -2961,7 +2961,7 @@ public function updateBatch_0Request($batch_input_json_node, $archived = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3254,7 +3254,7 @@ public function updateFoldersRequest($batch_input_json_node, $archived = null, s 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -3275,7 +3275,7 @@ public function updateFoldersRequest($batch_input_json_node, $archived = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/FoldersApi.php b/codegen/Cms/Pages/Api/FoldersApi.php index 426d2333..9763bf9b 100644 --- a/codegen/Cms/Pages/Api/FoldersApi.php +++ b/codegen/Cms/Pages/Api/FoldersApi.php @@ -360,7 +360,7 @@ public function archiveFolderRequest($object_id, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -624,7 +624,7 @@ public function createFolderRequest($content_folder, string $contentType = self: if (isset($content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_folder), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_folder; } @@ -645,7 +645,7 @@ public function createFolderRequest($content_folder, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -961,7 +961,7 @@ public function getFolderByIdRequest($object_id, $archived = null, $property = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1267,7 +1267,7 @@ public function getFolderPreviousVersionRequest($object_id, $revision_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1598,7 +1598,7 @@ public function getFolderPreviousVersionsRequest($object_id, $after = null, $bef } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2029,7 +2029,7 @@ public function getFoldersPageRequest($after = null, $archived = null, $created_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2322,7 +2322,7 @@ public function readFoldersRequest($batch_input_string, $archived = null, string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2343,7 +2343,7 @@ public function readFoldersRequest($batch_input_string, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2649,7 +2649,7 @@ public function restoreFolderPreviousVersionRequest($object_id, $revision_id, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2948,7 +2948,7 @@ public function updateFolderRequest($object_id, $content_folder, $archived = nul if (isset($content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_folder), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_folder; } @@ -2969,7 +2969,7 @@ public function updateFolderRequest($object_id, $content_folder, $archived = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/LandingPagesApi.php b/codegen/Cms/Pages/Api/LandingPagesApi.php index d38c1dca..0dc34bdd 100644 --- a/codegen/Cms/Pages/Api/LandingPagesApi.php +++ b/codegen/Cms/Pages/Api/LandingPagesApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -936,7 +936,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2429,7 +2429,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2658,7 +2658,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2957,7 +2957,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -2978,7 +2978,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3262,7 +3262,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -3283,7 +3283,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/MultiLanguageApi.php b/codegen/Cms/Pages/Api/MultiLanguageApi.php index 702ed05c..9667a793 100644 --- a/codegen/Cms/Pages/Api/MultiLanguageApi.php +++ b/codegen/Cms/Pages/Api/MultiLanguageApi.php @@ -365,7 +365,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -386,7 +386,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -636,7 +636,7 @@ public function attachToLangGroup_0Request($attach_to_lang_primary_request_v_nex 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 = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -657,7 +657,7 @@ public function attachToLangGroup_0Request($attach_to_lang_primary_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function createLangVariationRequest($content_language_clone_request_v_nex if (isset($content_language_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_language_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_language_clone_request_v_next; } @@ -942,7 +942,7 @@ public function createLangVariationRequest($content_language_clone_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1206,7 +1206,7 @@ public function createLangVariation_0Request($content_language_clone_request_v_n if (isset($content_language_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_language_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_language_clone_request_v_next; } @@ -1227,7 +1227,7 @@ public function createLangVariation_0Request($content_language_clone_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1477,7 +1477,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -1498,7 +1498,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1748,7 +1748,7 @@ public function detachFromLangGroup_0Request($detach_from_lang_group_request_v_n 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 = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -1769,7 +1769,7 @@ public function detachFromLangGroup_0Request($detach_from_lang_group_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1977,7 +1977,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1998,7 +1998,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2248,7 +2248,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -2269,7 +2269,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2519,7 +2519,7 @@ public function updateLangs_0Request($update_languages_request_v_next, string $c 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 = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -2540,7 +2540,7 @@ public function updateLangs_0Request($update_languages_request_v_next, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/SitePagesApi.php b/codegen/Cms/Pages/Api/SitePagesApi.php deleted file mode 100644 index 3306ba04..00000000 --- a/codegen/Cms/Pages/Api/SitePagesApi.php +++ /dev/null @@ -1,7738 +0,0 @@ - [ - 'application/json', - ], - 'archiveBatch' => [ - 'application/json', - ], - 'attachToLangGroup' => [ - 'application/json', - ], - 'callClone' => [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'createABTestVariation' => [ - 'application/json', - ], - 'createBatch' => [ - 'application/json', - ], - 'createLangVariation' => [ - 'application/json', - ], - 'detachFromLangGroup' => [ - 'application/json', - ], - 'endActiveABTest' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getDraftById' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'getPreviousVersion' => [ - 'application/json', - ], - 'getPreviousVersions' => [ - 'application/json', - ], - 'pushLive' => [ - 'application/json', - ], - 'readBatch' => [ - 'application/json', - ], - 'rerunPreviousABTest' => [ - 'application/json', - ], - 'resetDraft' => [ - 'application/json', - ], - 'restorePreviousVersion' => [ - 'application/json', - ], - 'restorePreviousVersionToDraft' => [ - 'application/json', - ], - 'schedule' => [ - 'application/json', - ], - 'setLangPrimary' => [ - 'application/json', - ], - 'update' => [ - 'application/json', - ], - 'updateBatch' => [ - 'application/json', - ], - 'updateDraft' => [ - '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 archive - * - * Delete a Site Page - * - * @param string $object_id The Site Page id. (required) - * @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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_id, $archived, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a Site Page - * - * @param string $object_id The Site Page id. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a Site Page - * - * @param string $object_id The Site Page id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_id, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a Site Page - * - * @param string $object_id The Site Page id. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($object_id, $archived = null, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_id, $archived, $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 $object_id The Site Page id. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($object_id, $archived = null, string $contentType = self::contentTypes['archive'][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 archive' - ); - } - - - - $resourcePath = '/cms/v3/pages/site-pages/{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 - 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( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation archiveBatch - * - * Delete a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function archiveBatch($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $this->archiveBatchWithHttpInfo($batch_input_string, $contentType); - } - - /** - * Operation archiveBatchWithHttpInfo - * - * Delete a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveBatchWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) - { - $request = $this->archiveBatchRequest($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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveBatchAsync - * - * Delete a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - return $this->archiveBatchAsyncWithHttpInfo($batch_input_string, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveBatchAsyncWithHttpInfo - * - * Delete a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - $returnType = ''; - $request = $this->archiveBatchRequest($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 'archiveBatch' - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] 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]) - { - - // 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 archiveBatch' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/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 attachToLangGroup - * - * Attach a site page to a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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 a site page to a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation attachToLangGroupAsync - * - * Attach a site page to a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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 a site page to a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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/pages/site-pages/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 callClone - * - * Clone a Site Page - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function callClone($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) - { - list($response) = $this->callCloneWithHttpInfo($content_clone_request_v_next, $contentType); - return $response; - } - - /** - * Operation callCloneWithHttpInfo - * - * Clone a Site Page - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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]) - { - $request = $this->callCloneRequest($content_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation callCloneAsync - * - * Clone a Site Page - * - * @param \HubSpot\Client\Cms\Pages\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 callCloneAsync($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) - { - return $this->callCloneAsyncWithHttpInfo($content_clone_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation callCloneAsyncWithHttpInfo - * - * Clone a Site Page - * - * @param \HubSpot\Client\Cms\Pages\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 callCloneAsyncWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->callCloneRequest($content_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 'callClone' - * - * @param \HubSpot\Client\Cms\Pages\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 callCloneRequest($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][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 $content_clone_request_v_next when calling callClone' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/clone'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // 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 ($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 new Site Page - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of a new Site Page. (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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function create($page, string $contentType = self::contentTypes['create'][0]) - { - $this->createWithHttpInfo($page, $contentType); - } - - /** - * Operation createWithHttpInfo - * - * Create a new Site Page - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of a new Site Page. (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\Pages\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 createWithHttpInfo($page, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($page, $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()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a new Site Page - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of a new Site Page. (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($page, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($page, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a new Site Page - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of a new Site Page. (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($page, string $contentType = self::contentTypes['create'][0]) - { - $returnType = ''; - $request = $this->createRequest($page, $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 'create' - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of a new Site Page. (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($page, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'page' is set - if ($page === null || (is_array($page) && count($page) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $page when calling create' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($page)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($page)); - } else { - $httpBody = $page; - } - } 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 createABTestVariation - * - * Create a new A/B test variation - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next The JSON representation of the AbTestCreateRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createABTestVariation'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function createABTestVariation($ab_test_create_request_v_next, string $contentType = self::contentTypes['createABTestVariation'][0]) - { - list($response) = $this->createABTestVariationWithHttpInfo($ab_test_create_request_v_next, $contentType); - return $response; - } - - /** - * Operation createABTestVariationWithHttpInfo - * - * Create a new A/B test variation - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next The JSON representation of the AbTestCreateRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createABTestVariation'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createABTestVariationWithHttpInfo($ab_test_create_request_v_next, string $contentType = self::contentTypes['createABTestVariation'][0]) - { - $request = $this->createABTestVariationRequest($ab_test_create_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 201: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createABTestVariationAsync - * - * Create a new A/B test variation - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next The JSON representation of the AbTestCreateRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createABTestVariation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createABTestVariationAsync($ab_test_create_request_v_next, string $contentType = self::contentTypes['createABTestVariation'][0]) - { - return $this->createABTestVariationAsyncWithHttpInfo($ab_test_create_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createABTestVariationAsyncWithHttpInfo - * - * Create a new A/B test variation - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next The JSON representation of the AbTestCreateRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createABTestVariation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createABTestVariationAsyncWithHttpInfo($ab_test_create_request_v_next, string $contentType = self::contentTypes['createABTestVariation'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->createABTestVariationRequest($ab_test_create_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 'createABTestVariation' - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestCreateRequestVNext $ab_test_create_request_v_next The JSON representation of the AbTestCreateRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createABTestVariation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createABTestVariationRequest($ab_test_create_request_v_next, string $contentType = self::contentTypes['createABTestVariation'][0]) - { - - // verify the required parameter 'ab_test_create_request_v_next' is set - if ($ab_test_create_request_v_next === null || (is_array($ab_test_create_request_v_next) && count($ab_test_create_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ab_test_create_request_v_next when calling createABTestVariation' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/ab-test/create-variation'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($ab_test_create_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($ab_test_create_request_v_next)); - } else { - $httpBody = $ab_test_create_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 createBatch - * - * Create a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputPage $batch_input_page The JSON array of new Site Pages 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 - * - * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function createBatch($batch_input_page, string $contentType = self::contentTypes['createBatch'][0]) - { - list($response) = $this->createBatchWithHttpInfo($batch_input_page, $contentType); - return $response; - } - - /** - * Operation createBatchWithHttpInfo - * - * Create a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputPage $batch_input_page The JSON array of new Site Pages 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 - * - * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createBatchWithHttpInfo($batch_input_page, string $contentType = self::contentTypes['createBatch'][0]) - { - $request = $this->createBatchRequest($batch_input_page, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createBatchAsync - * - * Create a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputPage $batch_input_page The JSON array of new Site Pages 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsync($batch_input_page, string $contentType = self::contentTypes['createBatch'][0]) - { - return $this->createBatchAsyncWithHttpInfo($batch_input_page, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createBatchAsyncWithHttpInfo - * - * Create a batch of Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputPage $batch_input_page The JSON array of new Site Pages 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsyncWithHttpInfo($batch_input_page, string $contentType = self::contentTypes['createBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; - $request = $this->createBatchRequest($batch_input_page, $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 'createBatch' - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputPage $batch_input_page The JSON array of new Site Pages 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createBatchRequest($batch_input_page, string $contentType = self::contentTypes['createBatch'][0]) - { - - // verify the required parameter 'batch_input_page' is set - if ($batch_input_page === null || (is_array($batch_input_page) && count($batch_input_page) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_page when calling createBatch' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/batch/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_page)) { - 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_page)); - } else { - $httpBody = $batch_input_page; - } - } 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 new language variation - * - * @param \HubSpot\Client\Cms\Pages\Model\ContentLanguageCloneRequestVNext $content_language_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function createLangVariation($content_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - list($response) = $this->createLangVariationWithHttpInfo($content_language_clone_request_v_next, $contentType); - return $response; - } - - /** - * Operation createLangVariationWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Pages\Model\ContentLanguageCloneRequestVNext $content_language_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createLangVariationWithHttpInfo($content_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $request = $this->createLangVariationRequest($content_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createLangVariationAsync - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Pages\Model\ContentLanguageCloneRequestVNext $content_language_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($content_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - return $this->createLangVariationAsyncWithHttpInfo($content_language_clone_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createLangVariationAsyncWithHttpInfo - * - * Create a new language variation - * - * @param \HubSpot\Client\Cms\Pages\Model\ContentLanguageCloneRequestVNext $content_language_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($content_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->createLangVariationRequest($content_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\Pages\Model\ContentLanguageCloneRequestVNext $content_language_clone_request_v_next The JSON representation of the ContentLanguageCloneRequest 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($content_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) - { - - // verify the required parameter 'content_language_clone_request_v_next' is set - if ($content_language_clone_request_v_next === null || (is_array($content_language_clone_request_v_next) && count($content_language_clone_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $content_language_clone_request_v_next when calling createLangVariation' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/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($content_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($content_language_clone_request_v_next)); - } else { - $httpBody = $content_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 a site page from a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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 a site page from a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation detachFromLangGroupAsync - * - * Detach a site page from a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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 a site page from a multi-language group - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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/pages/site-pages/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 endActiveABTest - * - * End an active A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestEndRequestVNext $ab_test_end_request_v_next The JSON representation of the AbTestEndRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endActiveABTest'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function endActiveABTest($ab_test_end_request_v_next, string $contentType = self::contentTypes['endActiveABTest'][0]) - { - $this->endActiveABTestWithHttpInfo($ab_test_end_request_v_next, $contentType); - } - - /** - * Operation endActiveABTestWithHttpInfo - * - * End an active A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestEndRequestVNext $ab_test_end_request_v_next The JSON representation of the AbTestEndRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endActiveABTest'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function endActiveABTestWithHttpInfo($ab_test_end_request_v_next, string $contentType = self::contentTypes['endActiveABTest'][0]) - { - $request = $this->endActiveABTestRequest($ab_test_end_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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation endActiveABTestAsync - * - * End an active A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestEndRequestVNext $ab_test_end_request_v_next The JSON representation of the AbTestEndRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endActiveABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function endActiveABTestAsync($ab_test_end_request_v_next, string $contentType = self::contentTypes['endActiveABTest'][0]) - { - return $this->endActiveABTestAsyncWithHttpInfo($ab_test_end_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation endActiveABTestAsyncWithHttpInfo - * - * End an active A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestEndRequestVNext $ab_test_end_request_v_next The JSON representation of the AbTestEndRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endActiveABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function endActiveABTestAsyncWithHttpInfo($ab_test_end_request_v_next, string $contentType = self::contentTypes['endActiveABTest'][0]) - { - $returnType = ''; - $request = $this->endActiveABTestRequest($ab_test_end_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 'endActiveABTest' - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestEndRequestVNext $ab_test_end_request_v_next The JSON representation of the AbTestEndRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['endActiveABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function endActiveABTestRequest($ab_test_end_request_v_next, string $contentType = self::contentTypes['endActiveABTest'][0]) - { - - // verify the required parameter 'ab_test_end_request_v_next' is set - if ($ab_test_end_request_v_next === null || (is_array($ab_test_end_request_v_next) && count($ab_test_end_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ab_test_end_request_v_next when calling endActiveABTest' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/ab-test/end'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($ab_test_end_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($ab_test_end_request_v_next)); - } else { - $httpBody = $ab_test_end_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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the site page to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the site page to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve a Site Page - * - * @param string $object_id The Site Page id. (required) - * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the site page to include in the response. (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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the site page to include in the response. (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\Pages\Model\Page'; - $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 Site Page id. (required) - * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string|null $property Specifies which properties of the site page to include in the response. (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/pages/site-pages/{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 Site Page - * - * @param string $object_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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 Site Page - * - * @param string $object_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getDraftByIdAsync - * - * Retrieve the full draft version of the Site Page - * - * @param string $object_id The Site Page 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 Site Page - * - * @param string $object_id The Site Page 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\Pages\Model\Page'; - $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 Site Page 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/pages/site-pages/{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 Site Pages - * - * @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 Specifies which properties of the site pages to include in the response. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging|\HubSpot\Client\Cms\Pages\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 Site Pages - * - * @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 Specifies which properties of the site pages to include in the response. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get all Site Pages - * - * @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 Specifies which properties of the site pages to include in the response. (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 Site Pages - * - * @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 Specifies which properties of the site pages to include in the response. (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\Pages\Model\CollectionResponseWithTotalPageForwardPaging'; - $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|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 Specifies which properties of the site pages to include in the response. (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/pages/site-pages'; - $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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\VersionPage|\HubSpot\Client\Cms\Pages\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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\VersionPage|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\VersionPage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\VersionPage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\VersionPage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPreviousVersionAsync - * - * Retrieves a previous version of a Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\Model\VersionPage'; - $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 Site Page id. (required) - * @param string $revision_id The Site Page 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/pages/site-pages/{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 Site Page - * - * @param string $object_id The Site Page id. (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 The cursor token value to retrieve the set of results before the current page. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage|\HubSpot\Client\Cms\Pages\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 Site Page - * - * @param string $object_id The Site Page id. (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 The cursor token value to retrieve the set of results before the current page. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPreviousVersionsAsync - * - * Retrieves all the previous versions of a Site Page - * - * @param string $object_id The Site Page id. (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 The cursor token value to retrieve the set of results before the current page. (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 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 Site Page - * - * @param string $object_id The Site Page id. (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 The cursor token value to retrieve the set of results before the current page. (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 getPreviousVersionsAsyncWithHttpInfo($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage'; - $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 Site Page id. (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 The cursor token value to retrieve the set of results before the current page. (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 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/pages/site-pages/{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 Site Page draft edits live - * - * @param string $object_id The id of the Site Page 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\Pages\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 Site Page draft edits live - * - * @param string $object_id The id of the Site Page 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\Pages\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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation pushLiveAsync - * - * Push Site Page draft edits live - * - * @param string $object_id The id of the Site Page 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 Site Page draft edits live - * - * @param string $object_id The id of the Site Page 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 Site Page 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/pages/site-pages/{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 Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\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 Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation readBatchAsync - * - * 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|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 - * @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 Site Pages - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readBatchAsyncWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; - $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\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @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 - * @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/pages/site-pages/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 rerunPreviousABTest - * - * Rerun a previous A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestRerunRequestVNext $ab_test_rerun_request_v_next The JSON representation of the AbTestRerunRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rerunPreviousABTest'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function rerunPreviousABTest($ab_test_rerun_request_v_next, string $contentType = self::contentTypes['rerunPreviousABTest'][0]) - { - $this->rerunPreviousABTestWithHttpInfo($ab_test_rerun_request_v_next, $contentType); - } - - /** - * Operation rerunPreviousABTestWithHttpInfo - * - * Rerun a previous A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestRerunRequestVNext $ab_test_rerun_request_v_next The JSON representation of the AbTestRerunRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rerunPreviousABTest'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function rerunPreviousABTestWithHttpInfo($ab_test_rerun_request_v_next, string $contentType = self::contentTypes['rerunPreviousABTest'][0]) - { - $request = $this->rerunPreviousABTestRequest($ab_test_rerun_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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation rerunPreviousABTestAsync - * - * Rerun a previous A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestRerunRequestVNext $ab_test_rerun_request_v_next The JSON representation of the AbTestRerunRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rerunPreviousABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function rerunPreviousABTestAsync($ab_test_rerun_request_v_next, string $contentType = self::contentTypes['rerunPreviousABTest'][0]) - { - return $this->rerunPreviousABTestAsyncWithHttpInfo($ab_test_rerun_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation rerunPreviousABTestAsyncWithHttpInfo - * - * Rerun a previous A/B test - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestRerunRequestVNext $ab_test_rerun_request_v_next The JSON representation of the AbTestRerunRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rerunPreviousABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function rerunPreviousABTestAsyncWithHttpInfo($ab_test_rerun_request_v_next, string $contentType = self::contentTypes['rerunPreviousABTest'][0]) - { - $returnType = ''; - $request = $this->rerunPreviousABTestRequest($ab_test_rerun_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 'rerunPreviousABTest' - * - * @param \HubSpot\Client\Cms\Pages\Model\AbTestRerunRequestVNext $ab_test_rerun_request_v_next The JSON representation of the AbTestRerunRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rerunPreviousABTest'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function rerunPreviousABTestRequest($ab_test_rerun_request_v_next, string $contentType = self::contentTypes['rerunPreviousABTest'][0]) - { - - // verify the required parameter 'ab_test_rerun_request_v_next' is set - if ($ab_test_rerun_request_v_next === null || (is_array($ab_test_rerun_request_v_next) && count($ab_test_rerun_request_v_next) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $ab_test_rerun_request_v_next when calling rerunPreviousABTest' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/ab-test/rerun'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($ab_test_rerun_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($ab_test_rerun_request_v_next)); - } else { - $httpBody = $ab_test_rerun_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 resetDraft - * - * Reset the Site Page draft to the live version - * - * @param string $object_id The id of the Site Page 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\Pages\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 Site Page draft to the live version - * - * @param string $object_id The id of the Site Page 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\Pages\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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation resetDraftAsync - * - * Reset the Site Page draft to the live version - * - * @param string $object_id The id of the Site Page 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 Site Page draft to the live version - * - * @param string $object_id The id of the Site Page 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 Site Page 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/pages/site-pages/{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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation restorePreviousVersionAsync - * - * Restore a previous version of a Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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 Site Page - * - * @param string $object_id The Site Page id. (required) - * @param string $revision_id The Site Page 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\Pages\Model\Page'; - $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 Site Page id. (required) - * @param string $revision_id The Site Page 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/pages/site-pages/{objectId}/revisions/{revisionId}/restore'; - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation restorePreviousVersionToDraft - * - * Restore a previous version of a Site Page, to the draft version of the Site Page - * - * @param string $object_id The Site Page id. (required) - * @param int $revision_id The Site Page 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 - * - * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function restorePreviousVersionToDraft($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) - { - list($response) = $this->restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, $contentType); - return $response; - } - - /** - * Operation restorePreviousVersionToDraftWithHttpInfo - * - * Restore a previous version of a Site Page, to the draft version of the Site Page - * - * @param string $object_id The Site Page id. (required) - * @param int $revision_id The Site Page 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 - * - * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) - { - $request = $this->restorePreviousVersionToDraftRequest($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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation restorePreviousVersionToDraftAsync - * - * Restore a previous version of a Site Page, to the draft version of the Site Page - * - * @param string $object_id The Site Page id. (required) - * @param int $revision_id The Site Page 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restorePreviousVersionToDraftAsync($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) - { - return $this->restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation restorePreviousVersionToDraftAsyncWithHttpInfo - * - * Restore a previous version of a Site Page, to the draft version of the Site Page - * - * @param string $object_id The Site Page id. (required) - * @param int $revision_id The Site Page 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->restorePreviousVersionToDraftRequest($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 'restorePreviousVersionToDraft' - * - * @param string $object_id The Site Page id. (required) - * @param int $revision_id The Site Page 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 - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - 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 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' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/{objectId}/revisions/{revisionId}/restore-to-draft'; - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation schedule - * - * Schedule a Site Page to be Published - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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]) - { - $this->scheduleWithHttpInfo($content_schedule_request_v_next, $contentType); - } - - /** - * Operation scheduleWithHttpInfo - * - * Schedule a Site Page to be Published - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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]) - { - $request = $this->scheduleRequest($content_schedule_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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation scheduleAsync - * - * Schedule a Site Page to be Published - * - * @param \HubSpot\Client\Cms\Pages\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 scheduleAsync($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) - { - return $this->scheduleAsyncWithHttpInfo($content_schedule_request_v_next, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation scheduleAsyncWithHttpInfo - * - * Schedule a Site Page to be Published - * - * @param \HubSpot\Client\Cms\Pages\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 scheduleAsyncWithHttpInfo($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) - { - $returnType = ''; - $request = $this->scheduleRequest($content_schedule_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 'schedule' - * - * @param \HubSpot\Client\Cms\Pages\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 scheduleRequest($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][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 $content_schedule_request_v_next when calling schedule' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/schedule'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // 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 ($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\Pages\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\Pages\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\Pages\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\Pages\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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation setLangPrimaryAsync - * - * Set a new primary language - * - * @param \HubSpot\Client\Cms\Pages\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\Pages\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\Pages\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/pages/site-pages/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 update - * - * Update a Site Page - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function update($object_id, $page, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_id, $page, $archived, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a Site Page - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_id, $page, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_id, $page, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a Site Page - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsync($object_id, $page, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_id, $page, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a Site Page - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsyncWithHttpInfo($object_id, $page, $archived = null, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->updateRequest($object_id, $page, $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 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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateRequest($object_id, $page, $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 update' - ); - } - - // verify the required parameter 'page' is set - if ($page === null || (is_array($page) && count($page) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $page when calling update' - ); - } - - - - $resourcePath = '/cms/v3/pages/site-pages/{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 - 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($page)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($page)); - } else { - $httpBody = $page; - } - } 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( - 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateBatch - * - * 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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function updateBatch($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - list($response) = $this->updateBatchWithHttpInfo($batch_input_json_node, $archived, $contentType); - return $response; - } - - /** - * Operation updateBatchWithHttpInfo - * - * 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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\BatchResponsePage|\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $request = $this->updateBatchRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\BatchResponsePageWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateBatchAsync - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsync($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - return $this->updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateBatchAsyncWithHttpInfo - * - * 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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; - $request = $this->updateBatchRequest($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 'updateBatch' - * - * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateBatchRequest($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][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 updateBatch' - ); - } - - - - $resourcePath = '/cms/v3/pages/site-pages/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 - ); - } - - /** - * Operation updateDraft - * - * Update a Site Page draft - * - * @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 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error - */ - public function updateDraft($object_id, $page, string $contentType = self::contentTypes['updateDraft'][0]) - { - list($response) = $this->updateDraftWithHttpInfo($object_id, $page, $contentType); - return $response; - } - - /** - * Operation updateDraftWithHttpInfo - * - * Update a Site Page draft - * - * @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 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\Pages\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Pages\Model\Page|\HubSpot\Client\Cms\Pages\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateDraftWithHttpInfo($object_id, $page, string $contentType = self::contentTypes['updateDraft'][0]) - { - $request = $this->updateDraftRequest($object_id, $page, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\Pages\Model\Page', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Page', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateDraftAsync - * - * Update a Site Page draft - * - * @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 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 updateDraftAsync($object_id, $page, string $contentType = self::contentTypes['updateDraft'][0]) - { - return $this->updateDraftAsyncWithHttpInfo($object_id, $page, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateDraftAsyncWithHttpInfo - * - * Update a Site Page draft - * - * @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 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 updateDraftAsyncWithHttpInfo($object_id, $page, string $contentType = self::contentTypes['updateDraft'][0]) - { - $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; - $request = $this->updateDraftRequest($object_id, $page, $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 'updateDraft' - * - * @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 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 updateDraftRequest($object_id, $page, string $contentType = self::contentTypes['updateDraft'][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 'page' is set - if ($page === null || (is_array($page) && count($page) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $page when calling updateDraft' - ); - } - - - $resourcePath = '/cms/v3/pages/site-pages/{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 (isset($page)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($page)); - } else { - $httpBody = $page; - } - } 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( - 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateLangs - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Pages\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Pages\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\Pages\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Pages\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\Pages\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateLangsAsync - * - * Update languages of multi-language group - * - * @param \HubSpot\Client\Cms\Pages\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Pages\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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\Pages\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the UpdateLanguagesRequest 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/pages/site-pages/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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/Pages/Api/WebsitePagesApi.php b/codegen/Cms/Pages/Api/WebsitePagesApi.php index 97c7ff3c..31d9f649 100644 --- a/codegen/Cms/Pages/Api/WebsitePagesApi.php +++ b/codegen/Cms/Pages/Api/WebsitePagesApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -936,7 +936,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2407,7 +2407,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2428,7 +2428,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2636,7 +2636,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -2657,7 +2657,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2956,7 +2956,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -2977,7 +2977,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3261,7 +3261,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -3282,7 +3282,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php deleted file mode 100644 index 13e8cd9b..00000000 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class CollectionResponseWithTotalVersionContentFolder implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalVersionContentFolder'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Cms\Pages\Model\Paging', - 'results' => '\HubSpot\Client\Cms\Pages\Model\VersionContentFolder[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Cms\Pages\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Cms\Pages\Model\Paging|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\Cms\Pages\Model\VersionContentFolder[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\Pages\Model\VersionContentFolder[] $results Collection of content folder versions. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of content folder versions. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Pages/Model/CollectionResponseWithTotalVersionPage.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php deleted file mode 100644 index 0eaf33ba..00000000 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class CollectionResponseWithTotalVersionPage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalVersionPage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Cms\Pages\Model\Paging', - 'results' => '\HubSpot\Client\Cms\Pages\Model\VersionPage[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Cms\Pages\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Cms\Pages\Model\Paging|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\Cms\Pages\Model\VersionPage[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\Pages\Model\VersionPage[] $results Collection of page versions. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of page versions. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Pages/Model/VersionContentFolder.php b/codegen/Cms/Pages/Model/VersionContentFolder.php deleted file mode 100644 index 73f05957..00000000 --- a/codegen/Cms/Pages/Model/VersionContentFolder.php +++ /dev/null @@ -1,524 +0,0 @@ - - */ -class VersionContentFolder implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'VersionContentFolder'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'string', - 'object' => '\HubSpot\Client\Cms\Pages\Model\ContentFolder', - 'updated_at' => '\DateTime', - 'user' => '\HubSpot\Client\Cms\Pages\Model\VersionUser' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => null, - 'object' => null, - 'updated_at' => 'date-time', - 'user' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'object' => false, - 'updated_at' => false, - 'user' => 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', - 'object' => 'object', - 'updated_at' => 'updatedAt', - 'user' => 'user' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'object' => 'setObject', - 'updated_at' => 'setUpdatedAt', - 'user' => 'setUser' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'object' => 'getObject', - 'updated_at' => 'getUpdatedAt', - 'user' => 'getUser' - ]; - - /** - * 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); - $this->setIfExists('object', $data ?? [], null); - $this->setIfExists('updated_at', $data ?? [], null); - $this->setIfExists('user', $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['object'] === null) { - $invalidProperties[] = "'object' can't be null"; - } - if ($this->container['updated_at'] === null) { - $invalidProperties[] = "'updated_at' can't be null"; - } - if ($this->container['user'] === null) { - $invalidProperties[] = "'user' 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 of this folder version. - * - * @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 - * - * @return \HubSpot\Client\Cms\Pages\Model\ContentFolder - */ - public function getObject() - { - return $this->container['object']; - } - - /** - * Sets object - * - * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $object object - * - * @return self - */ - public function setObject($object) - { - if (is_null($object)) { - throw new \InvalidArgumentException('non-nullable object cannot be null'); - } - $this->container['object'] = $object; - - return $this; - } - - /** - * Gets updated_at - * - * @return \DateTime - */ - public function getUpdatedAt() - { - return $this->container['updated_at']; - } - - /** - * Sets updated_at - * - * @param \DateTime $updated_at The timestamp indicating when this version of the content folder 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; - } - - /** - * Gets user - * - * @return \HubSpot\Client\Cms\Pages\Model\VersionUser - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \HubSpot\Client\Cms\Pages\Model\VersionUser $user user - * - * @return self - */ - public function setUser($user) - { - if (is_null($user)) { - throw new \InvalidArgumentException('non-nullable user cannot be null'); - } - $this->container['user'] = $user; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Pages/Model/VersionPage.php b/codegen/Cms/Pages/Model/VersionPage.php deleted file mode 100644 index ccfd8e85..00000000 --- a/codegen/Cms/Pages/Model/VersionPage.php +++ /dev/null @@ -1,524 +0,0 @@ - - */ -class VersionPage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'VersionPage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'string', - 'object' => '\HubSpot\Client\Cms\Pages\Model\Page', - 'updated_at' => '\DateTime', - 'user' => '\HubSpot\Client\Cms\Pages\Model\VersionUser' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => null, - 'object' => null, - 'updated_at' => 'date-time', - 'user' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'object' => false, - 'updated_at' => false, - 'user' => 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', - 'object' => 'object', - 'updated_at' => 'updatedAt', - 'user' => 'user' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'object' => 'setObject', - 'updated_at' => 'setUpdatedAt', - 'user' => 'setUser' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'object' => 'getObject', - 'updated_at' => 'getUpdatedAt', - 'user' => 'getUser' - ]; - - /** - * 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); - $this->setIfExists('object', $data ?? [], null); - $this->setIfExists('updated_at', $data ?? [], null); - $this->setIfExists('user', $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['object'] === null) { - $invalidProperties[] = "'object' can't be null"; - } - if ($this->container['updated_at'] === null) { - $invalidProperties[] = "'updated_at' can't be null"; - } - if ($this->container['user'] === null) { - $invalidProperties[] = "'user' 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 of this page version. - * - * @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 - * - * @return \HubSpot\Client\Cms\Pages\Model\Page - */ - public function getObject() - { - return $this->container['object']; - } - - /** - * Sets object - * - * @param \HubSpot\Client\Cms\Pages\Model\Page $object object - * - * @return self - */ - public function setObject($object) - { - if (is_null($object)) { - throw new \InvalidArgumentException('non-nullable object cannot be null'); - } - $this->container['object'] = $object; - - return $this; - } - - /** - * Gets updated_at - * - * @return \DateTime - */ - public function getUpdatedAt() - { - return $this->container['updated_at']; - } - - /** - * Sets updated_at - * - * @param \DateTime $updated_at The timestamp indicating when the page version 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; - } - - /** - * Gets user - * - * @return \HubSpot\Client\Cms\Pages\Model\VersionUser - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param \HubSpot\Client\Cms\Pages\Model\VersionUser $user user - * - * @return self - */ - public function setUser($user) - { - if (is_null($user)) { - throw new \InvalidArgumentException('non-nullable user cannot be null'); - } - $this->container['user'] = $user; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/SiteSearch/Api/BasicApi.php b/codegen/Cms/SiteSearch/Api/BasicApi.php index f810633a..516a5631 100644 --- a/codegen/Cms/SiteSearch/Api/BasicApi.php +++ b/codegen/Cms/SiteSearch/Api/BasicApi.php @@ -395,7 +395,7 @@ public function getByIdRequest($content_id, $type = null, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SiteSearch/Api/PublicApi.php b/codegen/Cms/SiteSearch/Api/PublicApi.php deleted file mode 100644 index b6d09e92..00000000 --- a/codegen/Cms/SiteSearch/Api/PublicApi.php +++ /dev/null @@ -1,1025 +0,0 @@ - [ - 'application/json', - ], - 'search' => [ - '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 getById - * - * Get indexed properties - * - * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SiteSearch\Model\IndexedData|\HubSpot\Client\Cms\SiteSearch\Model\Error - */ - public function getById($content_id, $type = null, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($content_id, $type, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get indexed properties - * - * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SiteSearch\Model\IndexedData|\HubSpot\Client\Cms\SiteSearch\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($content_id, $type = null, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($content_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\IndexedData', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\IndexedData', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\IndexedData', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get indexed properties - * - * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsync($content_id, $type = null, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($content_id, $type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get indexed properties - * - * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsyncWithHttpInfo($content_id, $type = null, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Cms\SiteSearch\Model\IndexedData'; - $request = $this->getByIdRequest($content_id, $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 'getById' - * - * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByIdRequest($content_id, $type = null, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'content_id' is set - if ($content_id === null || (is_array($content_id) && count($content_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $content_id when calling getById' - ); - } - if (!preg_match("/.*/", $content_id)) { - throw new \InvalidArgumentException("invalid value for \"content_id\" when calling PublicApi.getById, must conform to the pattern /.*/."); - } - - - - $resourcePath = '/cms/v3/site-search/indexed-data/{contentId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $type, - 'type', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($content_id !== null) { - $resourcePath = str_replace( - '{' . 'contentId' . '}', - ObjectSerializer::toPathValue($content_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 search - * - * Search your site - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults|\HubSpot\Client\Cms\SiteSearch\Model\Error - */ - public function search($q = null, $limit = null, $offset = null, $language = null, $match_prefix = null, $autocomplete = null, $popularity_boost = null, $boost_limit = null, $boost_recent = null, $table_id = null, $hubdb_query = null, $domain = null, $type = null, $path_prefix = null, $property = null, $length = null, $group_id = null, string $contentType = self::contentTypes['search'][0]) - { - list($response) = $this->searchWithHttpInfo($q, $limit, $offset, $language, $match_prefix, $autocomplete, $popularity_boost, $boost_limit, $boost_recent, $table_id, $hubdb_query, $domain, $type, $path_prefix, $property, $length, $group_id, $contentType); - return $response; - } - - /** - * Operation searchWithHttpInfo - * - * Search your site - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults|\HubSpot\Client\Cms\SiteSearch\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function searchWithHttpInfo($q = null, $limit = null, $offset = null, $language = null, $match_prefix = null, $autocomplete = null, $popularity_boost = null, $boost_limit = null, $boost_recent = null, $table_id = null, $hubdb_query = null, $domain = null, $type = null, $path_prefix = null, $property = null, $length = null, $group_id = null, string $contentType = self::contentTypes['search'][0]) - { - $request = $this->searchRequest($q, $limit, $offset, $language, $match_prefix, $autocomplete, $popularity_boost, $boost_limit, $boost_recent, $table_id, $hubdb_query, $domain, $type, $path_prefix, $property, $length, $group_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation searchAsync - * - * Search your site - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function searchAsync($q = null, $limit = null, $offset = null, $language = null, $match_prefix = null, $autocomplete = null, $popularity_boost = null, $boost_limit = null, $boost_recent = null, $table_id = null, $hubdb_query = null, $domain = null, $type = null, $path_prefix = null, $property = null, $length = null, $group_id = null, string $contentType = self::contentTypes['search'][0]) - { - return $this->searchAsyncWithHttpInfo($q, $limit, $offset, $language, $match_prefix, $autocomplete, $popularity_boost, $boost_limit, $boost_recent, $table_id, $hubdb_query, $domain, $type, $path_prefix, $property, $length, $group_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation searchAsyncWithHttpInfo - * - * Search your site - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function searchAsyncWithHttpInfo($q = null, $limit = null, $offset = null, $language = null, $match_prefix = null, $autocomplete = null, $popularity_boost = null, $boost_limit = null, $boost_recent = null, $table_id = null, $hubdb_query = null, $domain = null, $type = null, $path_prefix = null, $property = null, $length = null, $group_id = null, string $contentType = self::contentTypes['search'][0]) - { - $returnType = '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults'; - $request = $this->searchRequest($q, $limit, $offset, $language, $match_prefix, $autocomplete, $popularity_boost, $boost_limit, $boost_recent, $table_id, $hubdb_query, $domain, $type, $path_prefix, $property, $length, $group_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 'search' - * - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function searchRequest($q = null, $limit = null, $offset = null, $language = null, $match_prefix = null, $autocomplete = null, $popularity_boost = null, $boost_limit = null, $boost_recent = null, $table_id = null, $hubdb_query = null, $domain = null, $type = null, $path_prefix = null, $property = null, $length = null, $group_id = null, string $contentType = self::contentTypes['search'][0]) - { - - - - - - - - - - - - - - - - - - - - $resourcePath = '/cms/v3/site-search/search'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $q, - 'q', // 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( - $offset, - 'offset', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $language, - 'language', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $match_prefix, - 'matchPrefix', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $autocomplete, - 'autocomplete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $popularity_boost, - 'popularityBoost', // param base name - 'number', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $boost_limit, - 'boostLimit', // param base name - 'number', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $boost_recent, - 'boostRecent', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $table_id, - 'tableId', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $hubdb_query, - 'hubdbQuery', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $domain, - 'domain', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $type, - 'type', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $path_prefix, - 'pathPrefix', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $property, - 'property', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $length, - 'length', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $group_id, - 'groupId', // param base name - 'array', // 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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/SiteSearch/Api/SearchApi.php b/codegen/Cms/SiteSearch/Api/SearchApi.php deleted file mode 100644 index bdc188c9..00000000 --- a/codegen/Cms/SiteSearch/Api/SearchApi.php +++ /dev/null @@ -1,747 +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, - 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 getCmsSiteSearchV3Search - * - * Search your site - * - * @param bool|null $analytics (optional) - * @param bool|null $autocomplete (optional) - * @param float|null $boost_limit (optional) - * @param string|null $boost_recent (optional) - * @param string[]|null $domain (optional) - * @param int[]|null $group_id (optional) - * @param string|null $hubdb_query (optional) - * @param string|null $language (optional) - * @param string|null $length (optional) - * @param int|null $limit The maximum number of results to display per page. (optional) - * @param bool|null $match_prefix (optional) - * @param int|null $offset (optional) - * @param string[]|null $path_prefix (optional) - * @param float|null $popularity_boost (optional) - * @param string[]|null $property (optional) - * @param string|null $q (optional) - * @param int|null $table_id (optional) - * @param string[]|null $type (optional) - * @param string[]|null $types (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCmsSiteSearchV3Search'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults|\HubSpot\Client\Cms\SiteSearch\Model\Error - */ - public function getCmsSiteSearchV3Search($analytics = null, $autocomplete = null, $boost_limit = null, $boost_recent = null, $domain = null, $group_id = null, $hubdb_query = null, $language = null, $length = null, $limit = null, $match_prefix = null, $offset = null, $path_prefix = null, $popularity_boost = null, $property = null, $q = null, $table_id = null, $type = null, $types = null, string $contentType = self::contentTypes['getCmsSiteSearchV3Search'][0]) - { - list($response) = $this->getCmsSiteSearchV3SearchWithHttpInfo($analytics, $autocomplete, $boost_limit, $boost_recent, $domain, $group_id, $hubdb_query, $language, $length, $limit, $match_prefix, $offset, $path_prefix, $popularity_boost, $property, $q, $table_id, $type, $types, $contentType); - return $response; - } - - /** - * Operation getCmsSiteSearchV3SearchWithHttpInfo - * - * Search your site - * - * @param bool|null $analytics (optional) - * @param bool|null $autocomplete (optional) - * @param float|null $boost_limit (optional) - * @param string|null $boost_recent (optional) - * @param string[]|null $domain (optional) - * @param int[]|null $group_id (optional) - * @param string|null $hubdb_query (optional) - * @param string|null $language (optional) - * @param string|null $length (optional) - * @param int|null $limit The maximum number of results to display per page. (optional) - * @param bool|null $match_prefix (optional) - * @param int|null $offset (optional) - * @param string[]|null $path_prefix (optional) - * @param float|null $popularity_boost (optional) - * @param string[]|null $property (optional) - * @param string|null $q (optional) - * @param int|null $table_id (optional) - * @param string[]|null $type (optional) - * @param string[]|null $types (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCmsSiteSearchV3Search'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults|\HubSpot\Client\Cms\SiteSearch\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getCmsSiteSearchV3SearchWithHttpInfo($analytics = null, $autocomplete = null, $boost_limit = null, $boost_recent = null, $domain = null, $group_id = null, $hubdb_query = null, $language = null, $length = null, $limit = null, $match_prefix = null, $offset = null, $path_prefix = null, $popularity_boost = null, $property = null, $q = null, $table_id = null, $type = null, $types = null, string $contentType = self::contentTypes['getCmsSiteSearchV3Search'][0]) - { - $request = $this->getCmsSiteSearchV3SearchRequest($analytics, $autocomplete, $boost_limit, $boost_recent, $domain, $group_id, $hubdb_query, $language, $length, $limit, $match_prefix, $offset, $path_prefix, $popularity_boost, $property, $q, $table_id, $type, $types, $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(), - (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, - (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null - ); - } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SiteSearch\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getCmsSiteSearchV3SearchAsync - * - * Search your site - * - * @param bool|null $analytics (optional) - * @param bool|null $autocomplete (optional) - * @param float|null $boost_limit (optional) - * @param string|null $boost_recent (optional) - * @param string[]|null $domain (optional) - * @param int[]|null $group_id (optional) - * @param string|null $hubdb_query (optional) - * @param string|null $language (optional) - * @param string|null $length (optional) - * @param int|null $limit The maximum number of results to display per page. (optional) - * @param bool|null $match_prefix (optional) - * @param int|null $offset (optional) - * @param string[]|null $path_prefix (optional) - * @param float|null $popularity_boost (optional) - * @param string[]|null $property (optional) - * @param string|null $q (optional) - * @param int|null $table_id (optional) - * @param string[]|null $type (optional) - * @param string[]|null $types (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCmsSiteSearchV3Search'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCmsSiteSearchV3SearchAsync($analytics = null, $autocomplete = null, $boost_limit = null, $boost_recent = null, $domain = null, $group_id = null, $hubdb_query = null, $language = null, $length = null, $limit = null, $match_prefix = null, $offset = null, $path_prefix = null, $popularity_boost = null, $property = null, $q = null, $table_id = null, $type = null, $types = null, string $contentType = self::contentTypes['getCmsSiteSearchV3Search'][0]) - { - return $this->getCmsSiteSearchV3SearchAsyncWithHttpInfo($analytics, $autocomplete, $boost_limit, $boost_recent, $domain, $group_id, $hubdb_query, $language, $length, $limit, $match_prefix, $offset, $path_prefix, $popularity_boost, $property, $q, $table_id, $type, $types, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getCmsSiteSearchV3SearchAsyncWithHttpInfo - * - * Search your site - * - * @param bool|null $analytics (optional) - * @param bool|null $autocomplete (optional) - * @param float|null $boost_limit (optional) - * @param string|null $boost_recent (optional) - * @param string[]|null $domain (optional) - * @param int[]|null $group_id (optional) - * @param string|null $hubdb_query (optional) - * @param string|null $language (optional) - * @param string|null $length (optional) - * @param int|null $limit The maximum number of results to display per page. (optional) - * @param bool|null $match_prefix (optional) - * @param int|null $offset (optional) - * @param string[]|null $path_prefix (optional) - * @param float|null $popularity_boost (optional) - * @param string[]|null $property (optional) - * @param string|null $q (optional) - * @param int|null $table_id (optional) - * @param string[]|null $type (optional) - * @param string[]|null $types (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCmsSiteSearchV3Search'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCmsSiteSearchV3SearchAsyncWithHttpInfo($analytics = null, $autocomplete = null, $boost_limit = null, $boost_recent = null, $domain = null, $group_id = null, $hubdb_query = null, $language = null, $length = null, $limit = null, $match_prefix = null, $offset = null, $path_prefix = null, $popularity_boost = null, $property = null, $q = null, $table_id = null, $type = null, $types = null, string $contentType = self::contentTypes['getCmsSiteSearchV3Search'][0]) - { - $returnType = '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults'; - $request = $this->getCmsSiteSearchV3SearchRequest($analytics, $autocomplete, $boost_limit, $boost_recent, $domain, $group_id, $hubdb_query, $language, $length, $limit, $match_prefix, $offset, $path_prefix, $popularity_boost, $property, $q, $table_id, $type, $types, $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 = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; - $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response ? $response->getHeaders() : [], - $response ? (string) $response->getBody() : '' - ); - } - ); - } - - /** - * Create request for operation 'getCmsSiteSearchV3Search' - * - * @param bool|null $analytics (optional) - * @param bool|null $autocomplete (optional) - * @param float|null $boost_limit (optional) - * @param string|null $boost_recent (optional) - * @param string[]|null $domain (optional) - * @param int[]|null $group_id (optional) - * @param string|null $hubdb_query (optional) - * @param string|null $language (optional) - * @param string|null $length (optional) - * @param int|null $limit The maximum number of results to display per page. (optional) - * @param bool|null $match_prefix (optional) - * @param int|null $offset (optional) - * @param string[]|null $path_prefix (optional) - * @param float|null $popularity_boost (optional) - * @param string[]|null $property (optional) - * @param string|null $q (optional) - * @param int|null $table_id (optional) - * @param string[]|null $type (optional) - * @param string[]|null $types (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCmsSiteSearchV3Search'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getCmsSiteSearchV3SearchRequest($analytics = null, $autocomplete = null, $boost_limit = null, $boost_recent = null, $domain = null, $group_id = null, $hubdb_query = null, $language = null, $length = null, $limit = null, $match_prefix = null, $offset = null, $path_prefix = null, $popularity_boost = null, $property = null, $q = null, $table_id = null, $type = null, $types = null, string $contentType = self::contentTypes['getCmsSiteSearchV3Search'][0]) - { - - - - - - - - - - - - - - - - - - - - - - $resourcePath = '/cms/site-search/v3/search'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $analytics, - 'analytics', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $autocomplete, - 'autocomplete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $boost_limit, - 'boostLimit', // param base name - 'number', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $boost_recent, - 'boostRecent', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $domain, - 'domain', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $group_id, - 'groupId', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $hubdb_query, - 'hubdbQuery', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $language, - 'language', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $length, - 'length', // 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( - $match_prefix, - 'matchPrefix', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $offset, - 'offset', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $path_prefix, - 'pathPrefix', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $popularity_boost, - 'popularityBoost', // param base name - 'number', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $property, - 'property', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $q, - 'q', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $table_id, - 'tableId', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $type, - 'type', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $types, - 'types', // param base name - 'array', // 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 = json_encode($formParams, JSON_THROW_ON_ERROR); - } 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/SiteSearch/Model/ContentSearchResult.php b/codegen/Cms/SiteSearch/Model/ContentSearchResult.php deleted file mode 100644 index ee925963..00000000 --- a/codegen/Cms/SiteSearch/Model/ContentSearchResult.php +++ /dev/null @@ -1,2924 +0,0 @@ - - */ -class ContentSearchResult implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContentSearchResult'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'author_full_name' => 'string', - 'category' => 'string', - 'combined_id' => 'string', - 'content_type' => 'string', - 'description' => 'string', - 'domain' => 'string', - 'featured_image_url' => 'string', - 'id' => 'int', - 'in_beta' => 'bool', - 'is_private' => 'bool', - 'language' => 'string', - 'published_date' => 'int', - 'row_id' => 'int', - 'score' => 'float', - 'subcategory' => 'string', - 'table_id' => 'int', - 'tags' => 'string[]', - 'title' => 'string', - 'type' => 'string', - 'url' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'author_full_name' => null, - 'category' => null, - 'combined_id' => null, - 'content_type' => null, - 'description' => null, - 'domain' => null, - 'featured_image_url' => null, - 'id' => 'int64', - 'in_beta' => null, - 'is_private' => null, - 'language' => null, - 'published_date' => 'int64', - 'row_id' => 'int64', - 'score' => null, - 'subcategory' => null, - 'table_id' => 'int64', - 'tags' => null, - 'title' => null, - 'type' => null, - 'url' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'author_full_name' => false, - 'category' => false, - 'combined_id' => false, - 'content_type' => false, - 'description' => false, - 'domain' => false, - 'featured_image_url' => false, - 'id' => false, - 'in_beta' => false, - 'is_private' => false, - 'language' => false, - 'published_date' => false, - 'row_id' => false, - 'score' => false, - 'subcategory' => false, - 'table_id' => false, - 'tags' => false, - 'title' => false, - 'type' => 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 = [ - 'author_full_name' => 'authorFullName', - 'category' => 'category', - 'combined_id' => 'combinedId', - 'content_type' => 'contentType', - 'description' => 'description', - 'domain' => 'domain', - 'featured_image_url' => 'featuredImageUrl', - 'id' => 'id', - 'in_beta' => 'inBeta', - 'is_private' => 'isPrivate', - 'language' => 'language', - 'published_date' => 'publishedDate', - 'row_id' => 'rowId', - 'score' => 'score', - 'subcategory' => 'subcategory', - 'table_id' => 'tableId', - 'tags' => 'tags', - 'title' => 'title', - 'type' => 'type', - 'url' => 'url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'author_full_name' => 'setAuthorFullName', - 'category' => 'setCategory', - 'combined_id' => 'setCombinedId', - 'content_type' => 'setContentType', - 'description' => 'setDescription', - 'domain' => 'setDomain', - 'featured_image_url' => 'setFeaturedImageUrl', - 'id' => 'setId', - 'in_beta' => 'setInBeta', - 'is_private' => 'setIsPrivate', - 'language' => 'setLanguage', - 'published_date' => 'setPublishedDate', - 'row_id' => 'setRowId', - 'score' => 'setScore', - 'subcategory' => 'setSubcategory', - 'table_id' => 'setTableId', - 'tags' => 'setTags', - 'title' => 'setTitle', - 'type' => 'setType', - 'url' => 'setUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'author_full_name' => 'getAuthorFullName', - 'category' => 'getCategory', - 'combined_id' => 'getCombinedId', - 'content_type' => 'getContentType', - 'description' => 'getDescription', - 'domain' => 'getDomain', - 'featured_image_url' => 'getFeaturedImageUrl', - 'id' => 'getId', - 'in_beta' => 'getInBeta', - 'is_private' => 'getIsPrivate', - 'language' => 'getLanguage', - 'published_date' => 'getPublishedDate', - 'row_id' => 'getRowId', - 'score' => 'getScore', - 'subcategory' => 'getSubcategory', - 'table_id' => 'getTableId', - 'tags' => 'getTags', - 'title' => 'getTitle', - 'type' => 'getType', - '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; - } - - public const LANGUAGE_AA = 'aa'; - public const LANGUAGE_AB = 'ab'; - public const LANGUAGE_AE = 'ae'; - public const LANGUAGE_AF = 'af'; - public const LANGUAGE_AF_NA = 'af-na'; - public const LANGUAGE_AF_ZA = 'af-za'; - public const LANGUAGE_AGQ = 'agq'; - public const LANGUAGE_AGQ_CM = 'agq-cm'; - public const LANGUAGE_AK = 'ak'; - public const LANGUAGE_AK_GH = 'ak-gh'; - public const LANGUAGE_AM = 'am'; - public const LANGUAGE_AM_ET = 'am-et'; - public const LANGUAGE_AN = 'an'; - public const LANGUAGE_ANN = 'ann'; - public const LANGUAGE_ANN_NG = 'ann-ng'; - public const LANGUAGE_AR = 'ar'; - public const LANGUAGE_AR_001 = 'ar-001'; - public const LANGUAGE_AR_AE = 'ar-ae'; - public const LANGUAGE_AR_BH = 'ar-bh'; - public const LANGUAGE_AR_DJ = 'ar-dj'; - public const LANGUAGE_AR_DZ = 'ar-dz'; - public const LANGUAGE_AR_EG = 'ar-eg'; - public const LANGUAGE_AR_EH = 'ar-eh'; - public const LANGUAGE_AR_ER = 'ar-er'; - public const LANGUAGE_AR_IL = 'ar-il'; - public const LANGUAGE_AR_IQ = 'ar-iq'; - public const LANGUAGE_AR_JO = 'ar-jo'; - public const LANGUAGE_AR_KM = 'ar-km'; - public const LANGUAGE_AR_KW = 'ar-kw'; - public const LANGUAGE_AR_LB = 'ar-lb'; - public const LANGUAGE_AR_LY = 'ar-ly'; - public const LANGUAGE_AR_MA = 'ar-ma'; - public const LANGUAGE_AR_MR = 'ar-mr'; - public const LANGUAGE_AR_OM = 'ar-om'; - public const LANGUAGE_AR_PS = 'ar-ps'; - public const LANGUAGE_AR_QA = 'ar-qa'; - public const LANGUAGE_AR_SA = 'ar-sa'; - public const LANGUAGE_AR_SD = 'ar-sd'; - public const LANGUAGE_AR_SO = 'ar-so'; - public const LANGUAGE_AR_SS = 'ar-ss'; - public const LANGUAGE_AR_SY = 'ar-sy'; - public const LANGUAGE_AR_TD = 'ar-td'; - public const LANGUAGE_AR_TN = 'ar-tn'; - public const LANGUAGE_AR_YE = 'ar-ye'; - public const LANGUAGE__AS = 'as'; - public const LANGUAGE_AS_IN = 'as-in'; - public const LANGUAGE_ASA = 'asa'; - public const LANGUAGE_ASA_TZ = 'asa-tz'; - public const LANGUAGE_AST = 'ast'; - public const LANGUAGE_AST_ES = 'ast-es'; - public const LANGUAGE_AV = 'av'; - public const LANGUAGE_AY = 'ay'; - public const LANGUAGE_AZ = 'az'; - public const LANGUAGE_AZ_AZ = 'az-az'; - public const LANGUAGE_BA = 'ba'; - public const LANGUAGE_BAL = 'bal'; - public const LANGUAGE_BAL_PK = 'bal-pk'; - public const LANGUAGE_BAS = 'bas'; - public const LANGUAGE_BAS_CM = 'bas-cm'; - public const LANGUAGE_BE = 'be'; - public const LANGUAGE_BE_BY = 'be-by'; - public const LANGUAGE_BEM = 'bem'; - public const LANGUAGE_BEM_ZM = 'bem-zm'; - public const LANGUAGE_BEZ = 'bez'; - public const LANGUAGE_BEZ_TZ = 'bez-tz'; - public const LANGUAGE_BG = 'bg'; - public const LANGUAGE_BG_BG = 'bg-bg'; - public const LANGUAGE_BGC = 'bgc'; - public const LANGUAGE_BGC_IN = 'bgc-in'; - public const LANGUAGE_BHO = 'bho'; - public const LANGUAGE_BHO_IN = 'bho-in'; - public const LANGUAGE_BI = 'bi'; - public const LANGUAGE_BLO = 'blo'; - public const LANGUAGE_BLO_BJ = 'blo-bj'; - public const LANGUAGE_BM = 'bm'; - public const LANGUAGE_BM_ML = 'bm-ml'; - public const LANGUAGE_BN = 'bn'; - public const LANGUAGE_BN_BD = 'bn-bd'; - public const LANGUAGE_BN_IN = 'bn-in'; - public const LANGUAGE_BO = 'bo'; - public const LANGUAGE_BO_CN = 'bo-cn'; - public const LANGUAGE_BO_IN = 'bo-in'; - public const LANGUAGE_BR = 'br'; - public const LANGUAGE_BR_FR = 'br-fr'; - public const LANGUAGE_BRX = 'brx'; - public const LANGUAGE_BRX_IN = 'brx-in'; - public const LANGUAGE_BS = 'bs'; - public const LANGUAGE_BS_BA = 'bs-ba'; - public const LANGUAGE_CA = 'ca'; - public const LANGUAGE_CA_AD = 'ca-ad'; - public const LANGUAGE_CA_ES = 'ca-es'; - public const LANGUAGE_CA_FR = 'ca-fr'; - public const LANGUAGE_CA_IT = 'ca-it'; - public const LANGUAGE_CCP = 'ccp'; - public const LANGUAGE_CCP_BD = 'ccp-bd'; - public const LANGUAGE_CCP_IN = 'ccp-in'; - public const LANGUAGE_CE = 'ce'; - public const LANGUAGE_CE_RU = 'ce-ru'; - public const LANGUAGE_CEB = 'ceb'; - public const LANGUAGE_CEB_PH = 'ceb-ph'; - public const LANGUAGE_CGG = 'cgg'; - public const LANGUAGE_CGG_UG = 'cgg-ug'; - public const LANGUAGE_CH = 'ch'; - public const LANGUAGE_CHR = 'chr'; - public const LANGUAGE_CHR_US = 'chr-us'; - public const LANGUAGE_CKB = 'ckb'; - public const LANGUAGE_CKB_IQ = 'ckb-iq'; - public const LANGUAGE_CKB_IR = 'ckb-ir'; - public const LANGUAGE_CO = 'co'; - public const LANGUAGE_CR = 'cr'; - public const LANGUAGE_CS = 'cs'; - public const LANGUAGE_CS_CZ = 'cs-cz'; - public const LANGUAGE_CSW = 'csw'; - public const LANGUAGE_CSW_CA = 'csw-ca'; - public const LANGUAGE_CU = 'cu'; - public const LANGUAGE_CU_RU = 'cu-ru'; - public const LANGUAGE_CV = 'cv'; - public const LANGUAGE_CV_RU = 'cv-ru'; - public const LANGUAGE_CY = 'cy'; - public const LANGUAGE_CY_GB = 'cy-gb'; - public const LANGUAGE_DA = 'da'; - public const LANGUAGE_DA_DK = 'da-dk'; - public const LANGUAGE_DA_GL = 'da-gl'; - public const LANGUAGE_DAV = 'dav'; - public const LANGUAGE_DAV_KE = 'dav-ke'; - public const LANGUAGE_DE = 'de'; - public const LANGUAGE_DE_AT = 'de-at'; - public const LANGUAGE_DE_BE = 'de-be'; - public const LANGUAGE_DE_CH = 'de-ch'; - public const LANGUAGE_DE_DE = 'de-de'; - public const LANGUAGE_DE_GR = 'de-gr'; - public const LANGUAGE_DE_IT = 'de-it'; - public const LANGUAGE_DE_LI = 'de-li'; - public const LANGUAGE_DE_LU = 'de-lu'; - public const LANGUAGE_DJE = 'dje'; - public const LANGUAGE_DJE_NE = 'dje-ne'; - public const LANGUAGE_DOI = 'doi'; - public const LANGUAGE_DOI_IN = 'doi-in'; - public const LANGUAGE_DSB = 'dsb'; - public const LANGUAGE_DSB_DE = 'dsb-de'; - public const LANGUAGE_DUA = 'dua'; - public const LANGUAGE_DUA_CM = 'dua-cm'; - public const LANGUAGE_DV = 'dv'; - public const LANGUAGE_DYO = 'dyo'; - public const LANGUAGE_DYO_SN = 'dyo-sn'; - public const LANGUAGE_DZ = 'dz'; - public const LANGUAGE_DZ_BT = 'dz-bt'; - public const LANGUAGE_EBU = 'ebu'; - public const LANGUAGE_EBU_KE = 'ebu-ke'; - public const LANGUAGE_EE = 'ee'; - public const LANGUAGE_EE_GH = 'ee-gh'; - public const LANGUAGE_EE_TG = 'ee-tg'; - public const LANGUAGE_EL = 'el'; - public const LANGUAGE_EL_CY = 'el-cy'; - public const LANGUAGE_EL_GR = 'el-gr'; - public const LANGUAGE_EN = 'en'; - public const LANGUAGE_EN_001 = 'en-001'; - public const LANGUAGE_EN_150 = 'en-150'; - public const LANGUAGE_EN_AE = 'en-ae'; - public const LANGUAGE_EN_AG = 'en-ag'; - public const LANGUAGE_EN_AI = 'en-ai'; - public const LANGUAGE_EN_AS = 'en-as'; - public const LANGUAGE_EN_AT = 'en-at'; - public const LANGUAGE_EN_AU = 'en-au'; - public const LANGUAGE_EN_BB = 'en-bb'; - public const LANGUAGE_EN_BE = 'en-be'; - public const LANGUAGE_EN_BI = 'en-bi'; - public const LANGUAGE_EN_BM = 'en-bm'; - public const LANGUAGE_EN_BS = 'en-bs'; - public const LANGUAGE_EN_BW = 'en-bw'; - public const LANGUAGE_EN_BZ = 'en-bz'; - public const LANGUAGE_EN_CA = 'en-ca'; - public const LANGUAGE_EN_CC = 'en-cc'; - public const LANGUAGE_EN_CH = 'en-ch'; - public const LANGUAGE_EN_CK = 'en-ck'; - public const LANGUAGE_EN_CM = 'en-cm'; - public const LANGUAGE_EN_CN = 'en-cn'; - public const LANGUAGE_EN_CX = 'en-cx'; - public const LANGUAGE_EN_CY = 'en-cy'; - public const LANGUAGE_EN_CZ = 'en-cz'; - public const LANGUAGE_EN_DE = 'en-de'; - public const LANGUAGE_EN_DG = 'en-dg'; - public const LANGUAGE_EN_DK = 'en-dk'; - public const LANGUAGE_EN_DM = 'en-dm'; - public const LANGUAGE_EN_EE = 'en-ee'; - public const LANGUAGE_EN_EG = 'en-eg'; - public const LANGUAGE_EN_ER = 'en-er'; - public const LANGUAGE_EN_ES = 'en-es'; - public const LANGUAGE_EN_FI = 'en-fi'; - public const LANGUAGE_EN_FJ = 'en-fj'; - public const LANGUAGE_EN_FK = 'en-fk'; - public const LANGUAGE_EN_FM = 'en-fm'; - public const LANGUAGE_EN_FR = 'en-fr'; - public const LANGUAGE_EN_GB = 'en-gb'; - public const LANGUAGE_EN_GD = 'en-gd'; - public const LANGUAGE_EN_GG = 'en-gg'; - public const LANGUAGE_EN_GH = 'en-gh'; - public const LANGUAGE_EN_GI = 'en-gi'; - public const LANGUAGE_EN_GM = 'en-gm'; - public const LANGUAGE_EN_GS = 'en-gs'; - public const LANGUAGE_EN_GU = 'en-gu'; - public const LANGUAGE_EN_GY = 'en-gy'; - public const LANGUAGE_EN_HK = 'en-hk'; - public const LANGUAGE_EN_HU = 'en-hu'; - public const LANGUAGE_EN_ID = 'en-id'; - public const LANGUAGE_EN_IE = 'en-ie'; - public const LANGUAGE_EN_IL = 'en-il'; - public const LANGUAGE_EN_IM = 'en-im'; - public const LANGUAGE_EN_IN = 'en-in'; - public const LANGUAGE_EN_IO = 'en-io'; - public const LANGUAGE_EN_IT = 'en-it'; - public const LANGUAGE_EN_JE = 'en-je'; - public const LANGUAGE_EN_JM = 'en-jm'; - public const LANGUAGE_EN_KE = 'en-ke'; - public const LANGUAGE_EN_KI = 'en-ki'; - public const LANGUAGE_EN_KN = 'en-kn'; - public const LANGUAGE_EN_KY = 'en-ky'; - public const LANGUAGE_EN_LC = 'en-lc'; - public const LANGUAGE_EN_LR = 'en-lr'; - public const LANGUAGE_EN_LS = 'en-ls'; - public const LANGUAGE_EN_LU = 'en-lu'; - public const LANGUAGE_EN_MG = 'en-mg'; - public const LANGUAGE_EN_MH = 'en-mh'; - public const LANGUAGE_EN_MO = 'en-mo'; - public const LANGUAGE_EN_MP = 'en-mp'; - public const LANGUAGE_EN_MS = 'en-ms'; - public const LANGUAGE_EN_MT = 'en-mt'; - public const LANGUAGE_EN_MU = 'en-mu'; - public const LANGUAGE_EN_MV = 'en-mv'; - public const LANGUAGE_EN_MW = 'en-mw'; - public const LANGUAGE_EN_MX = 'en-mx'; - public const LANGUAGE_EN_MY = 'en-my'; - public const LANGUAGE_EN_NA = 'en-na'; - public const LANGUAGE_EN_NF = 'en-nf'; - public const LANGUAGE_EN_NG = 'en-ng'; - public const LANGUAGE_EN_NL = 'en-nl'; - public const LANGUAGE_EN_NO = 'en-no'; - public const LANGUAGE_EN_NR = 'en-nr'; - public const LANGUAGE_EN_NU = 'en-nu'; - public const LANGUAGE_EN_NZ = 'en-nz'; - public const LANGUAGE_EN_PG = 'en-pg'; - public const LANGUAGE_EN_PH = 'en-ph'; - public const LANGUAGE_EN_PK = 'en-pk'; - public const LANGUAGE_EN_PL = 'en-pl'; - public const LANGUAGE_EN_PN = 'en-pn'; - public const LANGUAGE_EN_PR = 'en-pr'; - public const LANGUAGE_EN_PT = 'en-pt'; - public const LANGUAGE_EN_PW = 'en-pw'; - public const LANGUAGE_EN_RO = 'en-ro'; - public const LANGUAGE_EN_RW = 'en-rw'; - public const LANGUAGE_EN_SB = 'en-sb'; - public const LANGUAGE_EN_SC = 'en-sc'; - public const LANGUAGE_EN_SD = 'en-sd'; - public const LANGUAGE_EN_SE = 'en-se'; - public const LANGUAGE_EN_SG = 'en-sg'; - public const LANGUAGE_EN_SH = 'en-sh'; - public const LANGUAGE_EN_SI = 'en-si'; - public const LANGUAGE_EN_SK = 'en-sk'; - public const LANGUAGE_EN_SL = 'en-sl'; - public const LANGUAGE_EN_SS = 'en-ss'; - public const LANGUAGE_EN_SX = 'en-sx'; - public const LANGUAGE_EN_SZ = 'en-sz'; - public const LANGUAGE_EN_TC = 'en-tc'; - public const LANGUAGE_EN_TH = 'en-th'; - public const LANGUAGE_EN_TK = 'en-tk'; - public const LANGUAGE_EN_TN = 'en-tn'; - public const LANGUAGE_EN_TO = 'en-to'; - public const LANGUAGE_EN_TT = 'en-tt'; - public const LANGUAGE_EN_TV = 'en-tv'; - public const LANGUAGE_EN_TZ = 'en-tz'; - public const LANGUAGE_EN_UG = 'en-ug'; - public const LANGUAGE_EN_UM = 'en-um'; - public const LANGUAGE_EN_US = 'en-us'; - public const LANGUAGE_EN_VC = 'en-vc'; - public const LANGUAGE_EN_VG = 'en-vg'; - public const LANGUAGE_EN_VI = 'en-vi'; - public const LANGUAGE_EN_VN = 'en-vn'; - public const LANGUAGE_EN_VU = 'en-vu'; - public const LANGUAGE_EN_WS = 'en-ws'; - public const LANGUAGE_EN_ZA = 'en-za'; - public const LANGUAGE_EN_ZM = 'en-zm'; - public const LANGUAGE_EN_ZW = 'en-zw'; - public const LANGUAGE_EO = 'eo'; - public const LANGUAGE_EO_001 = 'eo-001'; - public const LANGUAGE_ES = 'es'; - public const LANGUAGE_ES_419 = 'es-419'; - public const LANGUAGE_ES_AR = 'es-ar'; - public const LANGUAGE_ES_BO = 'es-bo'; - public const LANGUAGE_ES_BR = 'es-br'; - public const LANGUAGE_ES_BZ = 'es-bz'; - public const LANGUAGE_ES_CL = 'es-cl'; - public const LANGUAGE_ES_CO = 'es-co'; - public const LANGUAGE_ES_CR = 'es-cr'; - public const LANGUAGE_ES_CU = 'es-cu'; - public const LANGUAGE_ES_DO = 'es-do'; - public const LANGUAGE_ES_EA = 'es-ea'; - public const LANGUAGE_ES_EC = 'es-ec'; - public const LANGUAGE_ES_ES = 'es-es'; - public const LANGUAGE_ES_GQ = 'es-gq'; - public const LANGUAGE_ES_GT = 'es-gt'; - public const LANGUAGE_ES_HN = 'es-hn'; - public const LANGUAGE_ES_IC = 'es-ic'; - public const LANGUAGE_ES_MX = 'es-mx'; - public const LANGUAGE_ES_NI = 'es-ni'; - public const LANGUAGE_ES_PA = 'es-pa'; - public const LANGUAGE_ES_PE = 'es-pe'; - public const LANGUAGE_ES_PH = 'es-ph'; - public const LANGUAGE_ES_PR = 'es-pr'; - public const LANGUAGE_ES_PY = 'es-py'; - public const LANGUAGE_ES_SV = 'es-sv'; - public const LANGUAGE_ES_US = 'es-us'; - public const LANGUAGE_ES_UY = 'es-uy'; - public const LANGUAGE_ES_VE = 'es-ve'; - public const LANGUAGE_ET = 'et'; - public const LANGUAGE_ET_EE = 'et-ee'; - public const LANGUAGE_EU = 'eu'; - public const LANGUAGE_EU_ES = 'eu-es'; - public const LANGUAGE_EWO = 'ewo'; - public const LANGUAGE_EWO_CM = 'ewo-cm'; - public const LANGUAGE_FA = 'fa'; - public const LANGUAGE_FA_AF = 'fa-af'; - public const LANGUAGE_FA_IR = 'fa-ir'; - public const LANGUAGE_FF = 'ff'; - public const LANGUAGE_FF_BF = 'ff-bf'; - public const LANGUAGE_FF_CM = 'ff-cm'; - public const LANGUAGE_FF_GH = 'ff-gh'; - public const LANGUAGE_FF_GM = 'ff-gm'; - public const LANGUAGE_FF_GN = 'ff-gn'; - public const LANGUAGE_FF_GW = 'ff-gw'; - public const LANGUAGE_FF_LR = 'ff-lr'; - public const LANGUAGE_FF_MR = 'ff-mr'; - public const LANGUAGE_FF_NE = 'ff-ne'; - public const LANGUAGE_FF_NG = 'ff-ng'; - public const LANGUAGE_FF_SL = 'ff-sl'; - public const LANGUAGE_FF_SN = 'ff-sn'; - public const LANGUAGE_FI = 'fi'; - public const LANGUAGE_FI_FI = 'fi-fi'; - public const LANGUAGE_FIL = 'fil'; - public const LANGUAGE_FIL_PH = 'fil-ph'; - public const LANGUAGE_FJ = 'fj'; - public const LANGUAGE_FO = 'fo'; - public const LANGUAGE_FO_DK = 'fo-dk'; - public const LANGUAGE_FO_FO = 'fo-fo'; - public const LANGUAGE_FR = 'fr'; - public const LANGUAGE_FR_BE = 'fr-be'; - public const LANGUAGE_FR_BF = 'fr-bf'; - public const LANGUAGE_FR_BI = 'fr-bi'; - public const LANGUAGE_FR_BJ = 'fr-bj'; - public const LANGUAGE_FR_BL = 'fr-bl'; - public const LANGUAGE_FR_CA = 'fr-ca'; - public const LANGUAGE_FR_CD = 'fr-cd'; - public const LANGUAGE_FR_CF = 'fr-cf'; - public const LANGUAGE_FR_CG = 'fr-cg'; - public const LANGUAGE_FR_CH = 'fr-ch'; - public const LANGUAGE_FR_CI = 'fr-ci'; - public const LANGUAGE_FR_CM = 'fr-cm'; - public const LANGUAGE_FR_DJ = 'fr-dj'; - public const LANGUAGE_FR_DZ = 'fr-dz'; - public const LANGUAGE_FR_FR = 'fr-fr'; - public const LANGUAGE_FR_GA = 'fr-ga'; - public const LANGUAGE_FR_GF = 'fr-gf'; - public const LANGUAGE_FR_GN = 'fr-gn'; - public const LANGUAGE_FR_GP = 'fr-gp'; - public const LANGUAGE_FR_GQ = 'fr-gq'; - public const LANGUAGE_FR_HT = 'fr-ht'; - public const LANGUAGE_FR_KM = 'fr-km'; - public const LANGUAGE_FR_LU = 'fr-lu'; - public const LANGUAGE_FR_MA = 'fr-ma'; - public const LANGUAGE_FR_MC = 'fr-mc'; - public const LANGUAGE_FR_MF = 'fr-mf'; - public const LANGUAGE_FR_MG = 'fr-mg'; - public const LANGUAGE_FR_ML = 'fr-ml'; - public const LANGUAGE_FR_MQ = 'fr-mq'; - public const LANGUAGE_FR_MR = 'fr-mr'; - public const LANGUAGE_FR_MU = 'fr-mu'; - public const LANGUAGE_FR_NC = 'fr-nc'; - public const LANGUAGE_FR_NE = 'fr-ne'; - public const LANGUAGE_FR_PF = 'fr-pf'; - public const LANGUAGE_FR_PM = 'fr-pm'; - public const LANGUAGE_FR_RE = 'fr-re'; - public const LANGUAGE_FR_RW = 'fr-rw'; - public const LANGUAGE_FR_SC = 'fr-sc'; - public const LANGUAGE_FR_SN = 'fr-sn'; - public const LANGUAGE_FR_SY = 'fr-sy'; - public const LANGUAGE_FR_TD = 'fr-td'; - public const LANGUAGE_FR_TG = 'fr-tg'; - public const LANGUAGE_FR_TN = 'fr-tn'; - public const LANGUAGE_FR_VU = 'fr-vu'; - public const LANGUAGE_FR_WF = 'fr-wf'; - public const LANGUAGE_FR_YT = 'fr-yt'; - public const LANGUAGE_FRR = 'frr'; - public const LANGUAGE_FRR_DE = 'frr-de'; - public const LANGUAGE_FUR = 'fur'; - public const LANGUAGE_FUR_IT = 'fur-it'; - public const LANGUAGE_FY = 'fy'; - public const LANGUAGE_FY_NL = 'fy-nl'; - public const LANGUAGE_GA = 'ga'; - public const LANGUAGE_GA_GB = 'ga-gb'; - public const LANGUAGE_GA_IE = 'ga-ie'; - public const LANGUAGE_GAA = 'gaa'; - public const LANGUAGE_GAA_GH = 'gaa-gh'; - public const LANGUAGE_GD = 'gd'; - public const LANGUAGE_GD_GB = 'gd-gb'; - public const LANGUAGE_GL = 'gl'; - public const LANGUAGE_GL_ES = 'gl-es'; - public const LANGUAGE_GN = 'gn'; - public const LANGUAGE_GSW = 'gsw'; - public const LANGUAGE_GSW_CH = 'gsw-ch'; - public const LANGUAGE_GSW_FR = 'gsw-fr'; - public const LANGUAGE_GSW_LI = 'gsw-li'; - public const LANGUAGE_GU = 'gu'; - public const LANGUAGE_GU_IN = 'gu-in'; - public const LANGUAGE_GUZ = 'guz'; - public const LANGUAGE_GUZ_KE = 'guz-ke'; - public const LANGUAGE_GV = 'gv'; - public const LANGUAGE_GV_IM = 'gv-im'; - public const LANGUAGE_HA = 'ha'; - public const LANGUAGE_HA_GH = 'ha-gh'; - public const LANGUAGE_HA_NE = 'ha-ne'; - public const LANGUAGE_HA_NG = 'ha-ng'; - public const LANGUAGE_HAW = 'haw'; - public const LANGUAGE_HAW_US = 'haw-us'; - public const LANGUAGE_HE = 'he'; - public const LANGUAGE_HE_IL = 'he-il'; - public const LANGUAGE_HI = 'hi'; - public const LANGUAGE_HI_IN = 'hi-in'; - public const LANGUAGE_HMN = 'hmn'; - public const LANGUAGE_HO = 'ho'; - public const LANGUAGE_HR = 'hr'; - public const LANGUAGE_HR_BA = 'hr-ba'; - public const LANGUAGE_HR_HR = 'hr-hr'; - public const LANGUAGE_HSB = 'hsb'; - public const LANGUAGE_HSB_DE = 'hsb-de'; - public const LANGUAGE_HT = 'ht'; - public const LANGUAGE_HT_HT = 'ht-ht'; - public const LANGUAGE_HU = 'hu'; - public const LANGUAGE_HU_HU = 'hu-hu'; - public const LANGUAGE_HY = 'hy'; - public const LANGUAGE_HY_AM = 'hy-am'; - public const LANGUAGE_HZ = 'hz'; - public const LANGUAGE_IA = 'ia'; - public const LANGUAGE_IA_001 = 'ia-001'; - public const LANGUAGE_ID = 'id'; - public const LANGUAGE_ID_ID = 'id-id'; - public const LANGUAGE_IE = 'ie'; - public const LANGUAGE_IE_EE = 'ie-ee'; - public const LANGUAGE_IG = 'ig'; - public const LANGUAGE_IG_NG = 'ig-ng'; - public const LANGUAGE_II = 'ii'; - public const LANGUAGE_II_CN = 'ii-cn'; - public const LANGUAGE_IK = 'ik'; - public const LANGUAGE_IO = 'io'; - public const LANGUAGE_IS = 'is'; - public const LANGUAGE_IS_IS = 'is-is'; - public const LANGUAGE_IT = 'it'; - public const LANGUAGE_IT_CH = 'it-ch'; - public const LANGUAGE_IT_IT = 'it-it'; - public const LANGUAGE_IT_SM = 'it-sm'; - public const LANGUAGE_IT_VA = 'it-va'; - public const LANGUAGE_IU = 'iu'; - public const LANGUAGE_JA = 'ja'; - public const LANGUAGE_JA_JP = 'ja-jp'; - public const LANGUAGE_JGO = 'jgo'; - public const LANGUAGE_JGO_CM = 'jgo-cm'; - public const LANGUAGE_JMC = 'jmc'; - public const LANGUAGE_JMC_TZ = 'jmc-tz'; - public const LANGUAGE_JV = 'jv'; - public const LANGUAGE_JV_ID = 'jv-id'; - public const LANGUAGE_KA = 'ka'; - public const LANGUAGE_KA_GE = 'ka-ge'; - public const LANGUAGE_KAB = 'kab'; - public const LANGUAGE_KAB_DZ = 'kab-dz'; - public const LANGUAGE_KAM = 'kam'; - public const LANGUAGE_KAM_KE = 'kam-ke'; - public const LANGUAGE_KAR = 'kar'; - public const LANGUAGE_KDE = 'kde'; - public const LANGUAGE_KDE_TZ = 'kde-tz'; - public const LANGUAGE_KEA = 'kea'; - public const LANGUAGE_KEA_CV = 'kea-cv'; - public const LANGUAGE_KG = 'kg'; - public const LANGUAGE_KGP = 'kgp'; - public const LANGUAGE_KGP_BR = 'kgp-br'; - public const LANGUAGE_KH = 'kh'; - public const LANGUAGE_KHQ = 'khq'; - public const LANGUAGE_KHQ_ML = 'khq-ml'; - public const LANGUAGE_KI = 'ki'; - public const LANGUAGE_KI_KE = 'ki-ke'; - public const LANGUAGE_KJ = 'kj'; - public const LANGUAGE_KK = 'kk'; - public const LANGUAGE_KK_KZ = 'kk-kz'; - public const LANGUAGE_KKJ = 'kkj'; - public const LANGUAGE_KKJ_CM = 'kkj-cm'; - public const LANGUAGE_KL = 'kl'; - public const LANGUAGE_KL_GL = 'kl-gl'; - public const LANGUAGE_KLN = 'kln'; - public const LANGUAGE_KLN_KE = 'kln-ke'; - public const LANGUAGE_KM = 'km'; - public const LANGUAGE_KM_KH = 'km-kh'; - public const LANGUAGE_KN = 'kn'; - public const LANGUAGE_KN_IN = 'kn-in'; - public const LANGUAGE_KO = 'ko'; - public const LANGUAGE_KO_CN = 'ko-cn'; - public const LANGUAGE_KO_KP = 'ko-kp'; - public const LANGUAGE_KO_KR = 'ko-kr'; - public const LANGUAGE_KOK = 'kok'; - public const LANGUAGE_KOK_IN = 'kok-in'; - public const LANGUAGE_KR = 'kr'; - public const LANGUAGE_KS = 'ks'; - public const LANGUAGE_KS_IN = 'ks-in'; - public const LANGUAGE_KSB = 'ksb'; - public const LANGUAGE_KSB_TZ = 'ksb-tz'; - public const LANGUAGE_KSF = 'ksf'; - public const LANGUAGE_KSF_CM = 'ksf-cm'; - public const LANGUAGE_KSH = 'ksh'; - public const LANGUAGE_KSH_DE = 'ksh-de'; - public const LANGUAGE_KU = 'ku'; - public const LANGUAGE_KU_TR = 'ku-tr'; - public const LANGUAGE_KV = 'kv'; - public const LANGUAGE_KW = 'kw'; - public const LANGUAGE_KW_GB = 'kw-gb'; - public const LANGUAGE_KXV = 'kxv'; - public const LANGUAGE_KXV_IN = 'kxv-in'; - public const LANGUAGE_KY = 'ky'; - public const LANGUAGE_KY_KG = 'ky-kg'; - public const LANGUAGE_LA = 'la'; - public const LANGUAGE_LAG = 'lag'; - public const LANGUAGE_LAG_TZ = 'lag-tz'; - public const LANGUAGE_LB = 'lb'; - public const LANGUAGE_LB_LU = 'lb-lu'; - public const LANGUAGE_LG = 'lg'; - public const LANGUAGE_LG_UG = 'lg-ug'; - public const LANGUAGE_LI = 'li'; - public const LANGUAGE_LIJ = 'lij'; - public const LANGUAGE_LIJ_IT = 'lij-it'; - public const LANGUAGE_LKT = 'lkt'; - public const LANGUAGE_LKT_US = 'lkt-us'; - public const LANGUAGE_LMO = 'lmo'; - public const LANGUAGE_LMO_IT = 'lmo-it'; - public const LANGUAGE_LN = 'ln'; - public const LANGUAGE_LN_AO = 'ln-ao'; - public const LANGUAGE_LN_CD = 'ln-cd'; - public const LANGUAGE_LN_CF = 'ln-cf'; - public const LANGUAGE_LN_CG = 'ln-cg'; - public const LANGUAGE_LO = 'lo'; - public const LANGUAGE_LO_LA = 'lo-la'; - public const LANGUAGE_LRC = 'lrc'; - public const LANGUAGE_LRC_IQ = 'lrc-iq'; - public const LANGUAGE_LRC_IR = 'lrc-ir'; - public const LANGUAGE_LT = 'lt'; - public const LANGUAGE_LT_LT = 'lt-lt'; - public const LANGUAGE_LU = 'lu'; - public const LANGUAGE_LU_CD = 'lu-cd'; - public const LANGUAGE_LUO = 'luo'; - public const LANGUAGE_LUO_KE = 'luo-ke'; - public const LANGUAGE_LUY = 'luy'; - public const LANGUAGE_LUY_KE = 'luy-ke'; - public const LANGUAGE_LV = 'lv'; - public const LANGUAGE_LV_LV = 'lv-lv'; - public const LANGUAGE_MAI = 'mai'; - public const LANGUAGE_MAI_IN = 'mai-in'; - public const LANGUAGE_MAS = 'mas'; - public const LANGUAGE_MAS_KE = 'mas-ke'; - public const LANGUAGE_MAS_TZ = 'mas-tz'; - public const LANGUAGE_MDF = 'mdf'; - public const LANGUAGE_MDF_RU = 'mdf-ru'; - public const LANGUAGE_MER = 'mer'; - public const LANGUAGE_MER_KE = 'mer-ke'; - public const LANGUAGE_MFE = 'mfe'; - public const LANGUAGE_MFE_MU = 'mfe-mu'; - public const LANGUAGE_MG = 'mg'; - public const LANGUAGE_MG_MG = 'mg-mg'; - public const LANGUAGE_MGH = 'mgh'; - public const LANGUAGE_MGH_MZ = 'mgh-mz'; - public const LANGUAGE_MGO = 'mgo'; - public const LANGUAGE_MGO_CM = 'mgo-cm'; - public const LANGUAGE_MH = 'mh'; - public const LANGUAGE_MI = 'mi'; - public const LANGUAGE_MI_NZ = 'mi-nz'; - public const LANGUAGE_MK = 'mk'; - public const LANGUAGE_MK_MK = 'mk-mk'; - public const LANGUAGE_ML = 'ml'; - public const LANGUAGE_ML_IN = 'ml-in'; - public const LANGUAGE_MN = 'mn'; - public const LANGUAGE_MN_MN = 'mn-mn'; - public const LANGUAGE_MNI = 'mni'; - public const LANGUAGE_MNI_IN = 'mni-in'; - public const LANGUAGE_MR = 'mr'; - public const LANGUAGE_MR_IN = 'mr-in'; - public const LANGUAGE_MS = 'ms'; - public const LANGUAGE_MS_BN = 'ms-bn'; - public const LANGUAGE_MS_ID = 'ms-id'; - public const LANGUAGE_MS_MY = 'ms-my'; - public const LANGUAGE_MS_SG = 'ms-sg'; - public const LANGUAGE_MT = 'mt'; - public const LANGUAGE_MT_MT = 'mt-mt'; - public const LANGUAGE_MUA = 'mua'; - public const LANGUAGE_MUA_CM = 'mua-cm'; - public const LANGUAGE_MY = 'my'; - public const LANGUAGE_MY_MM = 'my-mm'; - public const LANGUAGE_MZN = 'mzn'; - public const LANGUAGE_MZN_IR = 'mzn-ir'; - public const LANGUAGE_NA = 'na'; - public const LANGUAGE_NAQ = 'naq'; - public const LANGUAGE_NAQ_NA = 'naq-na'; - public const LANGUAGE_NB = 'nb'; - public const LANGUAGE_NB_NO = 'nb-no'; - public const LANGUAGE_NB_SJ = 'nb-sj'; - public const LANGUAGE_ND = 'nd'; - public const LANGUAGE_ND_ZW = 'nd-zw'; - public const LANGUAGE_NDS = 'nds'; - public const LANGUAGE_NDS_DE = 'nds-de'; - public const LANGUAGE_NDS_NL = 'nds-nl'; - public const LANGUAGE_NE = 'ne'; - public const LANGUAGE_NE_IN = 'ne-in'; - public const LANGUAGE_NE_NP = 'ne-np'; - public const LANGUAGE_NG = 'ng'; - public const LANGUAGE_NL = 'nl'; - public const LANGUAGE_NL_AW = 'nl-aw'; - public const LANGUAGE_NL_BE = 'nl-be'; - public const LANGUAGE_NL_BQ = 'nl-bq'; - public const LANGUAGE_NL_CH = 'nl-ch'; - public const LANGUAGE_NL_CW = 'nl-cw'; - public const LANGUAGE_NL_LU = 'nl-lu'; - public const LANGUAGE_NL_NL = 'nl-nl'; - public const LANGUAGE_NL_SR = 'nl-sr'; - public const LANGUAGE_NL_SX = 'nl-sx'; - public const LANGUAGE_NMG = 'nmg'; - public const LANGUAGE_NMG_CM = 'nmg-cm'; - public const LANGUAGE_NN = 'nn'; - public const LANGUAGE_NN_NO = 'nn-no'; - public const LANGUAGE_NNH = 'nnh'; - public const LANGUAGE_NNH_CM = 'nnh-cm'; - public const LANGUAGE_NO = 'no'; - public const LANGUAGE_NO_NO = 'no-no'; - public const LANGUAGE_NQO = 'nqo'; - public const LANGUAGE_NQO_GN = 'nqo-gn'; - public const LANGUAGE_NR = 'nr'; - public const LANGUAGE_NSO = 'nso'; - public const LANGUAGE_NSO_ZA = 'nso-za'; - public const LANGUAGE_NUS = 'nus'; - public const LANGUAGE_NUS_SS = 'nus-ss'; - public const LANGUAGE_NV = 'nv'; - public const LANGUAGE_NY = 'ny'; - public const LANGUAGE_NYN = 'nyn'; - public const LANGUAGE_NYN_UG = 'nyn-ug'; - public const LANGUAGE_OC = 'oc'; - public const LANGUAGE_OC_ES = 'oc-es'; - public const LANGUAGE_OC_FR = 'oc-fr'; - public const LANGUAGE_OJ = 'oj'; - public const LANGUAGE_OM = 'om'; - public const LANGUAGE_OM_ET = 'om-et'; - public const LANGUAGE_OM_KE = 'om-ke'; - public const LANGUAGE__OR = 'or'; - public const LANGUAGE_OR_IN = 'or-in'; - public const LANGUAGE_OS = 'os'; - public const LANGUAGE_OS_GE = 'os-ge'; - public const LANGUAGE_OS_RU = 'os-ru'; - public const LANGUAGE_PA = 'pa'; - public const LANGUAGE_PA_IN = 'pa-in'; - public const LANGUAGE_PA_PK = 'pa-pk'; - public const LANGUAGE_PCM = 'pcm'; - public const LANGUAGE_PCM_NG = 'pcm-ng'; - public const LANGUAGE_PI = 'pi'; - public const LANGUAGE_PIS = 'pis'; - public const LANGUAGE_PIS_SB = 'pis-sb'; - public const LANGUAGE_PL = 'pl'; - public const LANGUAGE_PL_PL = 'pl-pl'; - public const LANGUAGE_PRG = 'prg'; - public const LANGUAGE_PRG_001 = 'prg-001'; - public const LANGUAGE_PS = 'ps'; - public const LANGUAGE_PS_AF = 'ps-af'; - public const LANGUAGE_PS_PK = 'ps-pk'; - public const LANGUAGE_PT = 'pt'; - public const LANGUAGE_PT_AO = 'pt-ao'; - public const LANGUAGE_PT_BR = 'pt-br'; - public const LANGUAGE_PT_CH = 'pt-ch'; - public const LANGUAGE_PT_CV = 'pt-cv'; - public const LANGUAGE_PT_GQ = 'pt-gq'; - public const LANGUAGE_PT_GW = 'pt-gw'; - public const LANGUAGE_PT_LU = 'pt-lu'; - public const LANGUAGE_PT_MO = 'pt-mo'; - public const LANGUAGE_PT_MZ = 'pt-mz'; - public const LANGUAGE_PT_PT = 'pt-pt'; - public const LANGUAGE_PT_ST = 'pt-st'; - public const LANGUAGE_PT_TL = 'pt-tl'; - public const LANGUAGE_QU = 'qu'; - public const LANGUAGE_QU_BO = 'qu-bo'; - public const LANGUAGE_QU_EC = 'qu-ec'; - public const LANGUAGE_QU_PE = 'qu-pe'; - public const LANGUAGE_RAJ = 'raj'; - public const LANGUAGE_RAJ_IN = 'raj-in'; - public const LANGUAGE_RM = 'rm'; - public const LANGUAGE_RM_CH = 'rm-ch'; - public const LANGUAGE_RN = 'rn'; - public const LANGUAGE_RN_BI = 'rn-bi'; - public const LANGUAGE_RO = 'ro'; - public const LANGUAGE_RO_MD = 'ro-md'; - public const LANGUAGE_RO_RO = 'ro-ro'; - public const LANGUAGE_ROF = 'rof'; - public const LANGUAGE_ROF_TZ = 'rof-tz'; - public const LANGUAGE_RU = 'ru'; - public const LANGUAGE_RU_BY = 'ru-by'; - public const LANGUAGE_RU_KG = 'ru-kg'; - public const LANGUAGE_RU_KZ = 'ru-kz'; - public const LANGUAGE_RU_MD = 'ru-md'; - public const LANGUAGE_RU_RU = 'ru-ru'; - public const LANGUAGE_RU_UA = 'ru-ua'; - public const LANGUAGE_RW = 'rw'; - public const LANGUAGE_RW_RW = 'rw-rw'; - public const LANGUAGE_RWK = 'rwk'; - public const LANGUAGE_RWK_TZ = 'rwk-tz'; - public const LANGUAGE_SA = 'sa'; - public const LANGUAGE_SA_IN = 'sa-in'; - public const LANGUAGE_SAH = 'sah'; - public const LANGUAGE_SAH_RU = 'sah-ru'; - public const LANGUAGE_SAQ = 'saq'; - public const LANGUAGE_SAQ_KE = 'saq-ke'; - public const LANGUAGE_SAT = 'sat'; - public const LANGUAGE_SAT_IN = 'sat-in'; - public const LANGUAGE_SBP = 'sbp'; - public const LANGUAGE_SBP_TZ = 'sbp-tz'; - public const LANGUAGE_SC = 'sc'; - public const LANGUAGE_SC_IT = 'sc-it'; - public const LANGUAGE_SD = 'sd'; - public const LANGUAGE_SD_IN = 'sd-in'; - public const LANGUAGE_SD_PK = 'sd-pk'; - public const LANGUAGE_SE = 'se'; - public const LANGUAGE_SE_FI = 'se-fi'; - public const LANGUAGE_SE_NO = 'se-no'; - public const LANGUAGE_SE_SE = 'se-se'; - public const LANGUAGE_SEH = 'seh'; - public const LANGUAGE_SEH_MZ = 'seh-mz'; - public const LANGUAGE_SES = 'ses'; - public const LANGUAGE_SES_ML = 'ses-ml'; - public const LANGUAGE_SG = 'sg'; - public const LANGUAGE_SG_CF = 'sg-cf'; - public const LANGUAGE_SHI = 'shi'; - public const LANGUAGE_SHI_MA = 'shi-ma'; - public const LANGUAGE_SI = 'si'; - public const LANGUAGE_SI_LK = 'si-lk'; - public const LANGUAGE_SK = 'sk'; - public const LANGUAGE_SK_SK = 'sk-sk'; - public const LANGUAGE_SL = 'sl'; - public const LANGUAGE_SL_SI = 'sl-si'; - public const LANGUAGE_SM = 'sm'; - public const LANGUAGE_SMN = 'smn'; - public const LANGUAGE_SMN_FI = 'smn-fi'; - public const LANGUAGE_SMS = 'sms'; - public const LANGUAGE_SMS_FI = 'sms-fi'; - public const LANGUAGE_SN = 'sn'; - public const LANGUAGE_SN_ZW = 'sn-zw'; - public const LANGUAGE_SO = 'so'; - public const LANGUAGE_SO_DJ = 'so-dj'; - public const LANGUAGE_SO_ET = 'so-et'; - public const LANGUAGE_SO_KE = 'so-ke'; - public const LANGUAGE_SO_SO = 'so-so'; - public const LANGUAGE_SQ = 'sq'; - public const LANGUAGE_SQ_AL = 'sq-al'; - public const LANGUAGE_SQ_MK = 'sq-mk'; - public const LANGUAGE_SQ_XK = 'sq-xk'; - public const LANGUAGE_SR = 'sr'; - public const LANGUAGE_SR_BA = 'sr-ba'; - public const LANGUAGE_SR_CS = 'sr-cs'; - public const LANGUAGE_SR_ME = 'sr-me'; - public const LANGUAGE_SR_RS = 'sr-rs'; - public const LANGUAGE_SR_XK = 'sr-xk'; - public const LANGUAGE_SS = 'ss'; - public const LANGUAGE_ST = 'st'; - public const LANGUAGE_ST_LS = 'st-ls'; - public const LANGUAGE_ST_ZA = 'st-za'; - public const LANGUAGE_SU = 'su'; - public const LANGUAGE_SU_ID = 'su-id'; - public const LANGUAGE_SV = 'sv'; - public const LANGUAGE_SV_AX = 'sv-ax'; - public const LANGUAGE_SV_FI = 'sv-fi'; - public const LANGUAGE_SV_SE = 'sv-se'; - public const LANGUAGE_SW = 'sw'; - public const LANGUAGE_SW_CD = 'sw-cd'; - public const LANGUAGE_SW_KE = 'sw-ke'; - public const LANGUAGE_SW_TZ = 'sw-tz'; - public const LANGUAGE_SW_UG = 'sw-ug'; - public const LANGUAGE_SY = 'sy'; - public const LANGUAGE_SYR = 'syr'; - public const LANGUAGE_SYR_IQ = 'syr-iq'; - public const LANGUAGE_SYR_SY = 'syr-sy'; - public const LANGUAGE_SZL = 'szl'; - public const LANGUAGE_SZL_PL = 'szl-pl'; - public const LANGUAGE_TA = 'ta'; - public const LANGUAGE_TA_IN = 'ta-in'; - public const LANGUAGE_TA_LK = 'ta-lk'; - public const LANGUAGE_TA_MY = 'ta-my'; - public const LANGUAGE_TA_SG = 'ta-sg'; - public const LANGUAGE_TE = 'te'; - public const LANGUAGE_TE_IN = 'te-in'; - public const LANGUAGE_TEO = 'teo'; - public const LANGUAGE_TEO_KE = 'teo-ke'; - public const LANGUAGE_TEO_UG = 'teo-ug'; - public const LANGUAGE_TG = 'tg'; - public const LANGUAGE_TG_TJ = 'tg-tj'; - public const LANGUAGE_TH = 'th'; - public const LANGUAGE_TH_TH = 'th-th'; - public const LANGUAGE_TI = 'ti'; - public const LANGUAGE_TI_ER = 'ti-er'; - public const LANGUAGE_TI_ET = 'ti-et'; - public const LANGUAGE_TK = 'tk'; - public const LANGUAGE_TK_TM = 'tk-tm'; - public const LANGUAGE_TL = 'tl'; - public const LANGUAGE_TN = 'tn'; - public const LANGUAGE_TN_BW = 'tn-bw'; - public const LANGUAGE_TN_ZA = 'tn-za'; - public const LANGUAGE_TO = 'to'; - public const LANGUAGE_TO_TO = 'to-to'; - public const LANGUAGE_TOK = 'tok'; - public const LANGUAGE_TOK_001 = 'tok-001'; - public const LANGUAGE_TR = 'tr'; - public const LANGUAGE_TR_CY = 'tr-cy'; - public const LANGUAGE_TR_TR = 'tr-tr'; - public const LANGUAGE_TS = 'ts'; - public const LANGUAGE_TT = 'tt'; - public const LANGUAGE_TT_RU = 'tt-ru'; - public const LANGUAGE_TW = 'tw'; - public const LANGUAGE_TWQ = 'twq'; - public const LANGUAGE_TWQ_NE = 'twq-ne'; - public const LANGUAGE_TY = 'ty'; - public const LANGUAGE_TZM = 'tzm'; - public const LANGUAGE_TZM_MA = 'tzm-ma'; - public const LANGUAGE_UG = 'ug'; - public const LANGUAGE_UG_CN = 'ug-cn'; - public const LANGUAGE_UK = 'uk'; - public const LANGUAGE_UK_UA = 'uk-ua'; - public const LANGUAGE_UR = 'ur'; - public const LANGUAGE_UR_IN = 'ur-in'; - public const LANGUAGE_UR_PK = 'ur-pk'; - public const LANGUAGE_UZ = 'uz'; - public const LANGUAGE_UZ_AF = 'uz-af'; - public const LANGUAGE_UZ_UZ = 'uz-uz'; - public const LANGUAGE_VAI = 'vai'; - public const LANGUAGE_VAI_LR = 'vai-lr'; - public const LANGUAGE_VE = 've'; - public const LANGUAGE_VEC = 'vec'; - public const LANGUAGE_VEC_IT = 'vec-it'; - public const LANGUAGE_VI = 'vi'; - public const LANGUAGE_VI_VN = 'vi-vn'; - public const LANGUAGE_VMW = 'vmw'; - public const LANGUAGE_VMW_MZ = 'vmw-mz'; - public const LANGUAGE_VO = 'vo'; - public const LANGUAGE_VO_001 = 'vo-001'; - public const LANGUAGE_VUN = 'vun'; - public const LANGUAGE_VUN_TZ = 'vun-tz'; - public const LANGUAGE_WA = 'wa'; - public const LANGUAGE_WAE = 'wae'; - public const LANGUAGE_WAE_CH = 'wae-ch'; - public const LANGUAGE_WO = 'wo'; - public const LANGUAGE_WO_SN = 'wo-sn'; - public const LANGUAGE_XH = 'xh'; - public const LANGUAGE_XH_ZA = 'xh-za'; - public const LANGUAGE_XNR = 'xnr'; - public const LANGUAGE_XNR_IN = 'xnr-in'; - public const LANGUAGE_XOG = 'xog'; - public const LANGUAGE_XOG_UG = 'xog-ug'; - public const LANGUAGE_YAV = 'yav'; - public const LANGUAGE_YAV_CM = 'yav-cm'; - public const LANGUAGE_YI = 'yi'; - public const LANGUAGE_YI_001 = 'yi-001'; - public const LANGUAGE_YI_UA = 'yi-ua'; - public const LANGUAGE_YO = 'yo'; - public const LANGUAGE_YO_BJ = 'yo-bj'; - public const LANGUAGE_YO_NG = 'yo-ng'; - public const LANGUAGE_YRL = 'yrl'; - public const LANGUAGE_YRL_BR = 'yrl-br'; - public const LANGUAGE_YRL_CO = 'yrl-co'; - public const LANGUAGE_YRL_VE = 'yrl-ve'; - public const LANGUAGE_YUE = 'yue'; - public const LANGUAGE_YUE_CN = 'yue-cn'; - public const LANGUAGE_YUE_HK = 'yue-hk'; - public const LANGUAGE_YUE_MO = 'yue-mo'; - public const LANGUAGE_ZA = 'za'; - public const LANGUAGE_ZA_CN = 'za-cn'; - public const LANGUAGE_ZGH = 'zgh'; - public const LANGUAGE_ZGH_MA = 'zgh-ma'; - public const LANGUAGE_ZH = 'zh'; - public const LANGUAGE_ZH_CN = 'zh-cn'; - public const LANGUAGE_ZH_HANS = 'zh-hans'; - public const LANGUAGE_ZH_HANT = 'zh-hant'; - public const LANGUAGE_ZH_HK = 'zh-hk'; - public const LANGUAGE_ZH_MO = 'zh-mo'; - public const LANGUAGE_ZH_MY = 'zh-my'; - public const LANGUAGE_ZH_SG = 'zh-sg'; - public const LANGUAGE_ZH_TW = 'zh-tw'; - public const LANGUAGE_ZU = 'zu'; - public const LANGUAGE_ZU_ZA = 'zu-za'; - public const TYPE_BLOG_POST = 'BLOG_POST'; - public const TYPE_KNOWLEDGE_ARTICLE = 'KNOWLEDGE_ARTICLE'; - public const TYPE_LANDING_PAGE = 'LANDING_PAGE'; - public const TYPE_LISTING_PAGE = 'LISTING_PAGE'; - public const TYPE_SITE_PAGE = 'SITE_PAGE'; - public const TYPE_STRUCTURED_CONTENT = 'STRUCTURED_CONTENT'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getLanguageAllowableValues() - { - return [ - self::LANGUAGE_AA, - self::LANGUAGE_AB, - self::LANGUAGE_AE, - self::LANGUAGE_AF, - self::LANGUAGE_AF_NA, - self::LANGUAGE_AF_ZA, - self::LANGUAGE_AGQ, - self::LANGUAGE_AGQ_CM, - self::LANGUAGE_AK, - self::LANGUAGE_AK_GH, - self::LANGUAGE_AM, - self::LANGUAGE_AM_ET, - self::LANGUAGE_AN, - self::LANGUAGE_ANN, - self::LANGUAGE_ANN_NG, - self::LANGUAGE_AR, - self::LANGUAGE_AR_001, - self::LANGUAGE_AR_AE, - self::LANGUAGE_AR_BH, - self::LANGUAGE_AR_DJ, - self::LANGUAGE_AR_DZ, - self::LANGUAGE_AR_EG, - self::LANGUAGE_AR_EH, - self::LANGUAGE_AR_ER, - self::LANGUAGE_AR_IL, - self::LANGUAGE_AR_IQ, - self::LANGUAGE_AR_JO, - self::LANGUAGE_AR_KM, - self::LANGUAGE_AR_KW, - self::LANGUAGE_AR_LB, - self::LANGUAGE_AR_LY, - self::LANGUAGE_AR_MA, - self::LANGUAGE_AR_MR, - self::LANGUAGE_AR_OM, - self::LANGUAGE_AR_PS, - self::LANGUAGE_AR_QA, - self::LANGUAGE_AR_SA, - self::LANGUAGE_AR_SD, - self::LANGUAGE_AR_SO, - self::LANGUAGE_AR_SS, - self::LANGUAGE_AR_SY, - self::LANGUAGE_AR_TD, - self::LANGUAGE_AR_TN, - self::LANGUAGE_AR_YE, - self::LANGUAGE__AS, - self::LANGUAGE_AS_IN, - self::LANGUAGE_ASA, - self::LANGUAGE_ASA_TZ, - self::LANGUAGE_AST, - self::LANGUAGE_AST_ES, - self::LANGUAGE_AV, - self::LANGUAGE_AY, - self::LANGUAGE_AZ, - self::LANGUAGE_AZ_AZ, - self::LANGUAGE_BA, - self::LANGUAGE_BAL, - self::LANGUAGE_BAL_PK, - self::LANGUAGE_BAS, - self::LANGUAGE_BAS_CM, - self::LANGUAGE_BE, - self::LANGUAGE_BE_BY, - self::LANGUAGE_BEM, - self::LANGUAGE_BEM_ZM, - self::LANGUAGE_BEZ, - self::LANGUAGE_BEZ_TZ, - self::LANGUAGE_BG, - self::LANGUAGE_BG_BG, - self::LANGUAGE_BGC, - self::LANGUAGE_BGC_IN, - self::LANGUAGE_BHO, - self::LANGUAGE_BHO_IN, - self::LANGUAGE_BI, - self::LANGUAGE_BLO, - self::LANGUAGE_BLO_BJ, - self::LANGUAGE_BM, - self::LANGUAGE_BM_ML, - self::LANGUAGE_BN, - self::LANGUAGE_BN_BD, - self::LANGUAGE_BN_IN, - self::LANGUAGE_BO, - self::LANGUAGE_BO_CN, - self::LANGUAGE_BO_IN, - self::LANGUAGE_BR, - self::LANGUAGE_BR_FR, - self::LANGUAGE_BRX, - self::LANGUAGE_BRX_IN, - self::LANGUAGE_BS, - self::LANGUAGE_BS_BA, - self::LANGUAGE_CA, - self::LANGUAGE_CA_AD, - self::LANGUAGE_CA_ES, - self::LANGUAGE_CA_FR, - self::LANGUAGE_CA_IT, - self::LANGUAGE_CCP, - self::LANGUAGE_CCP_BD, - self::LANGUAGE_CCP_IN, - self::LANGUAGE_CE, - self::LANGUAGE_CE_RU, - self::LANGUAGE_CEB, - self::LANGUAGE_CEB_PH, - self::LANGUAGE_CGG, - self::LANGUAGE_CGG_UG, - self::LANGUAGE_CH, - self::LANGUAGE_CHR, - self::LANGUAGE_CHR_US, - self::LANGUAGE_CKB, - self::LANGUAGE_CKB_IQ, - self::LANGUAGE_CKB_IR, - self::LANGUAGE_CO, - self::LANGUAGE_CR, - self::LANGUAGE_CS, - self::LANGUAGE_CS_CZ, - self::LANGUAGE_CSW, - self::LANGUAGE_CSW_CA, - self::LANGUAGE_CU, - self::LANGUAGE_CU_RU, - self::LANGUAGE_CV, - self::LANGUAGE_CV_RU, - self::LANGUAGE_CY, - self::LANGUAGE_CY_GB, - self::LANGUAGE_DA, - self::LANGUAGE_DA_DK, - self::LANGUAGE_DA_GL, - self::LANGUAGE_DAV, - self::LANGUAGE_DAV_KE, - self::LANGUAGE_DE, - self::LANGUAGE_DE_AT, - self::LANGUAGE_DE_BE, - self::LANGUAGE_DE_CH, - self::LANGUAGE_DE_DE, - self::LANGUAGE_DE_GR, - self::LANGUAGE_DE_IT, - self::LANGUAGE_DE_LI, - self::LANGUAGE_DE_LU, - self::LANGUAGE_DJE, - self::LANGUAGE_DJE_NE, - self::LANGUAGE_DOI, - self::LANGUAGE_DOI_IN, - self::LANGUAGE_DSB, - self::LANGUAGE_DSB_DE, - self::LANGUAGE_DUA, - self::LANGUAGE_DUA_CM, - self::LANGUAGE_DV, - self::LANGUAGE_DYO, - self::LANGUAGE_DYO_SN, - self::LANGUAGE_DZ, - self::LANGUAGE_DZ_BT, - self::LANGUAGE_EBU, - self::LANGUAGE_EBU_KE, - self::LANGUAGE_EE, - self::LANGUAGE_EE_GH, - self::LANGUAGE_EE_TG, - self::LANGUAGE_EL, - self::LANGUAGE_EL_CY, - self::LANGUAGE_EL_GR, - self::LANGUAGE_EN, - self::LANGUAGE_EN_001, - self::LANGUAGE_EN_150, - self::LANGUAGE_EN_AE, - self::LANGUAGE_EN_AG, - self::LANGUAGE_EN_AI, - self::LANGUAGE_EN_AS, - self::LANGUAGE_EN_AT, - self::LANGUAGE_EN_AU, - self::LANGUAGE_EN_BB, - self::LANGUAGE_EN_BE, - self::LANGUAGE_EN_BI, - self::LANGUAGE_EN_BM, - self::LANGUAGE_EN_BS, - self::LANGUAGE_EN_BW, - self::LANGUAGE_EN_BZ, - self::LANGUAGE_EN_CA, - self::LANGUAGE_EN_CC, - self::LANGUAGE_EN_CH, - self::LANGUAGE_EN_CK, - self::LANGUAGE_EN_CM, - self::LANGUAGE_EN_CN, - self::LANGUAGE_EN_CX, - self::LANGUAGE_EN_CY, - self::LANGUAGE_EN_CZ, - self::LANGUAGE_EN_DE, - self::LANGUAGE_EN_DG, - self::LANGUAGE_EN_DK, - self::LANGUAGE_EN_DM, - self::LANGUAGE_EN_EE, - self::LANGUAGE_EN_EG, - self::LANGUAGE_EN_ER, - self::LANGUAGE_EN_ES, - self::LANGUAGE_EN_FI, - self::LANGUAGE_EN_FJ, - self::LANGUAGE_EN_FK, - self::LANGUAGE_EN_FM, - self::LANGUAGE_EN_FR, - self::LANGUAGE_EN_GB, - self::LANGUAGE_EN_GD, - self::LANGUAGE_EN_GG, - self::LANGUAGE_EN_GH, - self::LANGUAGE_EN_GI, - self::LANGUAGE_EN_GM, - self::LANGUAGE_EN_GS, - self::LANGUAGE_EN_GU, - self::LANGUAGE_EN_GY, - self::LANGUAGE_EN_HK, - self::LANGUAGE_EN_HU, - self::LANGUAGE_EN_ID, - self::LANGUAGE_EN_IE, - self::LANGUAGE_EN_IL, - self::LANGUAGE_EN_IM, - self::LANGUAGE_EN_IN, - self::LANGUAGE_EN_IO, - self::LANGUAGE_EN_IT, - self::LANGUAGE_EN_JE, - self::LANGUAGE_EN_JM, - self::LANGUAGE_EN_KE, - self::LANGUAGE_EN_KI, - self::LANGUAGE_EN_KN, - self::LANGUAGE_EN_KY, - self::LANGUAGE_EN_LC, - self::LANGUAGE_EN_LR, - self::LANGUAGE_EN_LS, - self::LANGUAGE_EN_LU, - self::LANGUAGE_EN_MG, - self::LANGUAGE_EN_MH, - self::LANGUAGE_EN_MO, - self::LANGUAGE_EN_MP, - self::LANGUAGE_EN_MS, - self::LANGUAGE_EN_MT, - self::LANGUAGE_EN_MU, - self::LANGUAGE_EN_MV, - self::LANGUAGE_EN_MW, - self::LANGUAGE_EN_MX, - self::LANGUAGE_EN_MY, - self::LANGUAGE_EN_NA, - self::LANGUAGE_EN_NF, - self::LANGUAGE_EN_NG, - self::LANGUAGE_EN_NL, - self::LANGUAGE_EN_NO, - self::LANGUAGE_EN_NR, - self::LANGUAGE_EN_NU, - self::LANGUAGE_EN_NZ, - self::LANGUAGE_EN_PG, - self::LANGUAGE_EN_PH, - self::LANGUAGE_EN_PK, - self::LANGUAGE_EN_PL, - self::LANGUAGE_EN_PN, - self::LANGUAGE_EN_PR, - self::LANGUAGE_EN_PT, - self::LANGUAGE_EN_PW, - self::LANGUAGE_EN_RO, - self::LANGUAGE_EN_RW, - self::LANGUAGE_EN_SB, - self::LANGUAGE_EN_SC, - self::LANGUAGE_EN_SD, - self::LANGUAGE_EN_SE, - self::LANGUAGE_EN_SG, - self::LANGUAGE_EN_SH, - self::LANGUAGE_EN_SI, - self::LANGUAGE_EN_SK, - self::LANGUAGE_EN_SL, - self::LANGUAGE_EN_SS, - self::LANGUAGE_EN_SX, - self::LANGUAGE_EN_SZ, - self::LANGUAGE_EN_TC, - self::LANGUAGE_EN_TH, - self::LANGUAGE_EN_TK, - self::LANGUAGE_EN_TN, - self::LANGUAGE_EN_TO, - self::LANGUAGE_EN_TT, - self::LANGUAGE_EN_TV, - self::LANGUAGE_EN_TZ, - self::LANGUAGE_EN_UG, - self::LANGUAGE_EN_UM, - self::LANGUAGE_EN_US, - self::LANGUAGE_EN_VC, - self::LANGUAGE_EN_VG, - self::LANGUAGE_EN_VI, - self::LANGUAGE_EN_VN, - self::LANGUAGE_EN_VU, - self::LANGUAGE_EN_WS, - self::LANGUAGE_EN_ZA, - self::LANGUAGE_EN_ZM, - self::LANGUAGE_EN_ZW, - self::LANGUAGE_EO, - self::LANGUAGE_EO_001, - self::LANGUAGE_ES, - self::LANGUAGE_ES_419, - self::LANGUAGE_ES_AR, - self::LANGUAGE_ES_BO, - self::LANGUAGE_ES_BR, - self::LANGUAGE_ES_BZ, - self::LANGUAGE_ES_CL, - self::LANGUAGE_ES_CO, - self::LANGUAGE_ES_CR, - self::LANGUAGE_ES_CU, - self::LANGUAGE_ES_DO, - self::LANGUAGE_ES_EA, - self::LANGUAGE_ES_EC, - self::LANGUAGE_ES_ES, - self::LANGUAGE_ES_GQ, - self::LANGUAGE_ES_GT, - self::LANGUAGE_ES_HN, - self::LANGUAGE_ES_IC, - self::LANGUAGE_ES_MX, - self::LANGUAGE_ES_NI, - self::LANGUAGE_ES_PA, - self::LANGUAGE_ES_PE, - self::LANGUAGE_ES_PH, - self::LANGUAGE_ES_PR, - self::LANGUAGE_ES_PY, - self::LANGUAGE_ES_SV, - self::LANGUAGE_ES_US, - self::LANGUAGE_ES_UY, - self::LANGUAGE_ES_VE, - self::LANGUAGE_ET, - self::LANGUAGE_ET_EE, - self::LANGUAGE_EU, - self::LANGUAGE_EU_ES, - self::LANGUAGE_EWO, - self::LANGUAGE_EWO_CM, - self::LANGUAGE_FA, - self::LANGUAGE_FA_AF, - self::LANGUAGE_FA_IR, - self::LANGUAGE_FF, - self::LANGUAGE_FF_BF, - self::LANGUAGE_FF_CM, - self::LANGUAGE_FF_GH, - self::LANGUAGE_FF_GM, - self::LANGUAGE_FF_GN, - self::LANGUAGE_FF_GW, - self::LANGUAGE_FF_LR, - self::LANGUAGE_FF_MR, - self::LANGUAGE_FF_NE, - self::LANGUAGE_FF_NG, - self::LANGUAGE_FF_SL, - self::LANGUAGE_FF_SN, - self::LANGUAGE_FI, - self::LANGUAGE_FI_FI, - self::LANGUAGE_FIL, - self::LANGUAGE_FIL_PH, - self::LANGUAGE_FJ, - self::LANGUAGE_FO, - self::LANGUAGE_FO_DK, - self::LANGUAGE_FO_FO, - self::LANGUAGE_FR, - self::LANGUAGE_FR_BE, - self::LANGUAGE_FR_BF, - self::LANGUAGE_FR_BI, - self::LANGUAGE_FR_BJ, - self::LANGUAGE_FR_BL, - self::LANGUAGE_FR_CA, - self::LANGUAGE_FR_CD, - self::LANGUAGE_FR_CF, - self::LANGUAGE_FR_CG, - self::LANGUAGE_FR_CH, - self::LANGUAGE_FR_CI, - self::LANGUAGE_FR_CM, - self::LANGUAGE_FR_DJ, - self::LANGUAGE_FR_DZ, - self::LANGUAGE_FR_FR, - self::LANGUAGE_FR_GA, - self::LANGUAGE_FR_GF, - self::LANGUAGE_FR_GN, - self::LANGUAGE_FR_GP, - self::LANGUAGE_FR_GQ, - self::LANGUAGE_FR_HT, - self::LANGUAGE_FR_KM, - self::LANGUAGE_FR_LU, - self::LANGUAGE_FR_MA, - self::LANGUAGE_FR_MC, - self::LANGUAGE_FR_MF, - self::LANGUAGE_FR_MG, - self::LANGUAGE_FR_ML, - self::LANGUAGE_FR_MQ, - self::LANGUAGE_FR_MR, - self::LANGUAGE_FR_MU, - self::LANGUAGE_FR_NC, - self::LANGUAGE_FR_NE, - self::LANGUAGE_FR_PF, - self::LANGUAGE_FR_PM, - self::LANGUAGE_FR_RE, - self::LANGUAGE_FR_RW, - self::LANGUAGE_FR_SC, - self::LANGUAGE_FR_SN, - self::LANGUAGE_FR_SY, - self::LANGUAGE_FR_TD, - self::LANGUAGE_FR_TG, - self::LANGUAGE_FR_TN, - self::LANGUAGE_FR_VU, - self::LANGUAGE_FR_WF, - self::LANGUAGE_FR_YT, - self::LANGUAGE_FRR, - self::LANGUAGE_FRR_DE, - self::LANGUAGE_FUR, - self::LANGUAGE_FUR_IT, - self::LANGUAGE_FY, - self::LANGUAGE_FY_NL, - self::LANGUAGE_GA, - self::LANGUAGE_GA_GB, - self::LANGUAGE_GA_IE, - self::LANGUAGE_GAA, - self::LANGUAGE_GAA_GH, - self::LANGUAGE_GD, - self::LANGUAGE_GD_GB, - self::LANGUAGE_GL, - self::LANGUAGE_GL_ES, - self::LANGUAGE_GN, - self::LANGUAGE_GSW, - self::LANGUAGE_GSW_CH, - self::LANGUAGE_GSW_FR, - self::LANGUAGE_GSW_LI, - self::LANGUAGE_GU, - self::LANGUAGE_GU_IN, - self::LANGUAGE_GUZ, - self::LANGUAGE_GUZ_KE, - self::LANGUAGE_GV, - self::LANGUAGE_GV_IM, - self::LANGUAGE_HA, - self::LANGUAGE_HA_GH, - self::LANGUAGE_HA_NE, - self::LANGUAGE_HA_NG, - self::LANGUAGE_HAW, - self::LANGUAGE_HAW_US, - self::LANGUAGE_HE, - self::LANGUAGE_HE_IL, - self::LANGUAGE_HI, - self::LANGUAGE_HI_IN, - self::LANGUAGE_HMN, - self::LANGUAGE_HO, - self::LANGUAGE_HR, - self::LANGUAGE_HR_BA, - self::LANGUAGE_HR_HR, - self::LANGUAGE_HSB, - self::LANGUAGE_HSB_DE, - self::LANGUAGE_HT, - self::LANGUAGE_HT_HT, - self::LANGUAGE_HU, - self::LANGUAGE_HU_HU, - self::LANGUAGE_HY, - self::LANGUAGE_HY_AM, - self::LANGUAGE_HZ, - self::LANGUAGE_IA, - self::LANGUAGE_IA_001, - self::LANGUAGE_ID, - self::LANGUAGE_ID_ID, - self::LANGUAGE_IE, - self::LANGUAGE_IE_EE, - self::LANGUAGE_IG, - self::LANGUAGE_IG_NG, - self::LANGUAGE_II, - self::LANGUAGE_II_CN, - self::LANGUAGE_IK, - self::LANGUAGE_IO, - self::LANGUAGE_IS, - self::LANGUAGE_IS_IS, - self::LANGUAGE_IT, - self::LANGUAGE_IT_CH, - self::LANGUAGE_IT_IT, - self::LANGUAGE_IT_SM, - self::LANGUAGE_IT_VA, - self::LANGUAGE_IU, - self::LANGUAGE_JA, - self::LANGUAGE_JA_JP, - self::LANGUAGE_JGO, - self::LANGUAGE_JGO_CM, - self::LANGUAGE_JMC, - self::LANGUAGE_JMC_TZ, - self::LANGUAGE_JV, - self::LANGUAGE_JV_ID, - self::LANGUAGE_KA, - self::LANGUAGE_KA_GE, - self::LANGUAGE_KAB, - self::LANGUAGE_KAB_DZ, - self::LANGUAGE_KAM, - self::LANGUAGE_KAM_KE, - self::LANGUAGE_KAR, - self::LANGUAGE_KDE, - self::LANGUAGE_KDE_TZ, - self::LANGUAGE_KEA, - self::LANGUAGE_KEA_CV, - self::LANGUAGE_KG, - self::LANGUAGE_KGP, - self::LANGUAGE_KGP_BR, - self::LANGUAGE_KH, - self::LANGUAGE_KHQ, - self::LANGUAGE_KHQ_ML, - self::LANGUAGE_KI, - self::LANGUAGE_KI_KE, - self::LANGUAGE_KJ, - self::LANGUAGE_KK, - self::LANGUAGE_KK_KZ, - self::LANGUAGE_KKJ, - self::LANGUAGE_KKJ_CM, - self::LANGUAGE_KL, - self::LANGUAGE_KL_GL, - self::LANGUAGE_KLN, - self::LANGUAGE_KLN_KE, - self::LANGUAGE_KM, - self::LANGUAGE_KM_KH, - self::LANGUAGE_KN, - self::LANGUAGE_KN_IN, - self::LANGUAGE_KO, - self::LANGUAGE_KO_CN, - self::LANGUAGE_KO_KP, - self::LANGUAGE_KO_KR, - self::LANGUAGE_KOK, - self::LANGUAGE_KOK_IN, - self::LANGUAGE_KR, - self::LANGUAGE_KS, - self::LANGUAGE_KS_IN, - self::LANGUAGE_KSB, - self::LANGUAGE_KSB_TZ, - self::LANGUAGE_KSF, - self::LANGUAGE_KSF_CM, - self::LANGUAGE_KSH, - self::LANGUAGE_KSH_DE, - self::LANGUAGE_KU, - self::LANGUAGE_KU_TR, - self::LANGUAGE_KV, - self::LANGUAGE_KW, - self::LANGUAGE_KW_GB, - self::LANGUAGE_KXV, - self::LANGUAGE_KXV_IN, - self::LANGUAGE_KY, - self::LANGUAGE_KY_KG, - self::LANGUAGE_LA, - self::LANGUAGE_LAG, - self::LANGUAGE_LAG_TZ, - self::LANGUAGE_LB, - self::LANGUAGE_LB_LU, - self::LANGUAGE_LG, - self::LANGUAGE_LG_UG, - self::LANGUAGE_LI, - self::LANGUAGE_LIJ, - self::LANGUAGE_LIJ_IT, - self::LANGUAGE_LKT, - self::LANGUAGE_LKT_US, - self::LANGUAGE_LMO, - self::LANGUAGE_LMO_IT, - self::LANGUAGE_LN, - self::LANGUAGE_LN_AO, - self::LANGUAGE_LN_CD, - self::LANGUAGE_LN_CF, - self::LANGUAGE_LN_CG, - self::LANGUAGE_LO, - self::LANGUAGE_LO_LA, - self::LANGUAGE_LRC, - self::LANGUAGE_LRC_IQ, - self::LANGUAGE_LRC_IR, - self::LANGUAGE_LT, - self::LANGUAGE_LT_LT, - self::LANGUAGE_LU, - self::LANGUAGE_LU_CD, - self::LANGUAGE_LUO, - self::LANGUAGE_LUO_KE, - self::LANGUAGE_LUY, - self::LANGUAGE_LUY_KE, - self::LANGUAGE_LV, - self::LANGUAGE_LV_LV, - self::LANGUAGE_MAI, - self::LANGUAGE_MAI_IN, - self::LANGUAGE_MAS, - self::LANGUAGE_MAS_KE, - self::LANGUAGE_MAS_TZ, - self::LANGUAGE_MDF, - self::LANGUAGE_MDF_RU, - self::LANGUAGE_MER, - self::LANGUAGE_MER_KE, - self::LANGUAGE_MFE, - self::LANGUAGE_MFE_MU, - self::LANGUAGE_MG, - self::LANGUAGE_MG_MG, - self::LANGUAGE_MGH, - self::LANGUAGE_MGH_MZ, - self::LANGUAGE_MGO, - self::LANGUAGE_MGO_CM, - self::LANGUAGE_MH, - self::LANGUAGE_MI, - self::LANGUAGE_MI_NZ, - self::LANGUAGE_MK, - self::LANGUAGE_MK_MK, - self::LANGUAGE_ML, - self::LANGUAGE_ML_IN, - self::LANGUAGE_MN, - self::LANGUAGE_MN_MN, - self::LANGUAGE_MNI, - self::LANGUAGE_MNI_IN, - self::LANGUAGE_MR, - self::LANGUAGE_MR_IN, - self::LANGUAGE_MS, - self::LANGUAGE_MS_BN, - self::LANGUAGE_MS_ID, - self::LANGUAGE_MS_MY, - self::LANGUAGE_MS_SG, - self::LANGUAGE_MT, - self::LANGUAGE_MT_MT, - self::LANGUAGE_MUA, - self::LANGUAGE_MUA_CM, - self::LANGUAGE_MY, - self::LANGUAGE_MY_MM, - self::LANGUAGE_MZN, - self::LANGUAGE_MZN_IR, - self::LANGUAGE_NA, - self::LANGUAGE_NAQ, - self::LANGUAGE_NAQ_NA, - self::LANGUAGE_NB, - self::LANGUAGE_NB_NO, - self::LANGUAGE_NB_SJ, - self::LANGUAGE_ND, - self::LANGUAGE_ND_ZW, - self::LANGUAGE_NDS, - self::LANGUAGE_NDS_DE, - self::LANGUAGE_NDS_NL, - self::LANGUAGE_NE, - self::LANGUAGE_NE_IN, - self::LANGUAGE_NE_NP, - self::LANGUAGE_NG, - self::LANGUAGE_NL, - self::LANGUAGE_NL_AW, - self::LANGUAGE_NL_BE, - self::LANGUAGE_NL_BQ, - self::LANGUAGE_NL_CH, - self::LANGUAGE_NL_CW, - self::LANGUAGE_NL_LU, - self::LANGUAGE_NL_NL, - self::LANGUAGE_NL_SR, - self::LANGUAGE_NL_SX, - self::LANGUAGE_NMG, - self::LANGUAGE_NMG_CM, - self::LANGUAGE_NN, - self::LANGUAGE_NN_NO, - self::LANGUAGE_NNH, - self::LANGUAGE_NNH_CM, - self::LANGUAGE_NO, - self::LANGUAGE_NO_NO, - self::LANGUAGE_NQO, - self::LANGUAGE_NQO_GN, - self::LANGUAGE_NR, - self::LANGUAGE_NSO, - self::LANGUAGE_NSO_ZA, - self::LANGUAGE_NUS, - self::LANGUAGE_NUS_SS, - self::LANGUAGE_NV, - self::LANGUAGE_NY, - self::LANGUAGE_NYN, - self::LANGUAGE_NYN_UG, - self::LANGUAGE_OC, - self::LANGUAGE_OC_ES, - self::LANGUAGE_OC_FR, - self::LANGUAGE_OJ, - self::LANGUAGE_OM, - self::LANGUAGE_OM_ET, - self::LANGUAGE_OM_KE, - self::LANGUAGE__OR, - self::LANGUAGE_OR_IN, - self::LANGUAGE_OS, - self::LANGUAGE_OS_GE, - self::LANGUAGE_OS_RU, - self::LANGUAGE_PA, - self::LANGUAGE_PA_IN, - self::LANGUAGE_PA_PK, - self::LANGUAGE_PCM, - self::LANGUAGE_PCM_NG, - self::LANGUAGE_PI, - self::LANGUAGE_PIS, - self::LANGUAGE_PIS_SB, - self::LANGUAGE_PL, - self::LANGUAGE_PL_PL, - self::LANGUAGE_PRG, - self::LANGUAGE_PRG_001, - self::LANGUAGE_PS, - self::LANGUAGE_PS_AF, - self::LANGUAGE_PS_PK, - self::LANGUAGE_PT, - self::LANGUAGE_PT_AO, - self::LANGUAGE_PT_BR, - self::LANGUAGE_PT_CH, - self::LANGUAGE_PT_CV, - self::LANGUAGE_PT_GQ, - self::LANGUAGE_PT_GW, - self::LANGUAGE_PT_LU, - self::LANGUAGE_PT_MO, - self::LANGUAGE_PT_MZ, - self::LANGUAGE_PT_PT, - self::LANGUAGE_PT_ST, - self::LANGUAGE_PT_TL, - self::LANGUAGE_QU, - self::LANGUAGE_QU_BO, - self::LANGUAGE_QU_EC, - self::LANGUAGE_QU_PE, - self::LANGUAGE_RAJ, - self::LANGUAGE_RAJ_IN, - self::LANGUAGE_RM, - self::LANGUAGE_RM_CH, - self::LANGUAGE_RN, - self::LANGUAGE_RN_BI, - self::LANGUAGE_RO, - self::LANGUAGE_RO_MD, - self::LANGUAGE_RO_RO, - self::LANGUAGE_ROF, - self::LANGUAGE_ROF_TZ, - self::LANGUAGE_RU, - self::LANGUAGE_RU_BY, - self::LANGUAGE_RU_KG, - self::LANGUAGE_RU_KZ, - self::LANGUAGE_RU_MD, - self::LANGUAGE_RU_RU, - self::LANGUAGE_RU_UA, - self::LANGUAGE_RW, - self::LANGUAGE_RW_RW, - self::LANGUAGE_RWK, - self::LANGUAGE_RWK_TZ, - self::LANGUAGE_SA, - self::LANGUAGE_SA_IN, - self::LANGUAGE_SAH, - self::LANGUAGE_SAH_RU, - self::LANGUAGE_SAQ, - self::LANGUAGE_SAQ_KE, - self::LANGUAGE_SAT, - self::LANGUAGE_SAT_IN, - self::LANGUAGE_SBP, - self::LANGUAGE_SBP_TZ, - self::LANGUAGE_SC, - self::LANGUAGE_SC_IT, - self::LANGUAGE_SD, - self::LANGUAGE_SD_IN, - self::LANGUAGE_SD_PK, - self::LANGUAGE_SE, - self::LANGUAGE_SE_FI, - self::LANGUAGE_SE_NO, - self::LANGUAGE_SE_SE, - self::LANGUAGE_SEH, - self::LANGUAGE_SEH_MZ, - self::LANGUAGE_SES, - self::LANGUAGE_SES_ML, - self::LANGUAGE_SG, - self::LANGUAGE_SG_CF, - self::LANGUAGE_SHI, - self::LANGUAGE_SHI_MA, - self::LANGUAGE_SI, - self::LANGUAGE_SI_LK, - self::LANGUAGE_SK, - self::LANGUAGE_SK_SK, - self::LANGUAGE_SL, - self::LANGUAGE_SL_SI, - self::LANGUAGE_SM, - self::LANGUAGE_SMN, - self::LANGUAGE_SMN_FI, - self::LANGUAGE_SMS, - self::LANGUAGE_SMS_FI, - self::LANGUAGE_SN, - self::LANGUAGE_SN_ZW, - self::LANGUAGE_SO, - self::LANGUAGE_SO_DJ, - self::LANGUAGE_SO_ET, - self::LANGUAGE_SO_KE, - self::LANGUAGE_SO_SO, - self::LANGUAGE_SQ, - self::LANGUAGE_SQ_AL, - self::LANGUAGE_SQ_MK, - self::LANGUAGE_SQ_XK, - self::LANGUAGE_SR, - self::LANGUAGE_SR_BA, - self::LANGUAGE_SR_CS, - self::LANGUAGE_SR_ME, - self::LANGUAGE_SR_RS, - self::LANGUAGE_SR_XK, - self::LANGUAGE_SS, - self::LANGUAGE_ST, - self::LANGUAGE_ST_LS, - self::LANGUAGE_ST_ZA, - self::LANGUAGE_SU, - self::LANGUAGE_SU_ID, - self::LANGUAGE_SV, - self::LANGUAGE_SV_AX, - self::LANGUAGE_SV_FI, - self::LANGUAGE_SV_SE, - self::LANGUAGE_SW, - self::LANGUAGE_SW_CD, - self::LANGUAGE_SW_KE, - self::LANGUAGE_SW_TZ, - self::LANGUAGE_SW_UG, - self::LANGUAGE_SY, - self::LANGUAGE_SYR, - self::LANGUAGE_SYR_IQ, - self::LANGUAGE_SYR_SY, - self::LANGUAGE_SZL, - self::LANGUAGE_SZL_PL, - self::LANGUAGE_TA, - self::LANGUAGE_TA_IN, - self::LANGUAGE_TA_LK, - self::LANGUAGE_TA_MY, - self::LANGUAGE_TA_SG, - self::LANGUAGE_TE, - self::LANGUAGE_TE_IN, - self::LANGUAGE_TEO, - self::LANGUAGE_TEO_KE, - self::LANGUAGE_TEO_UG, - self::LANGUAGE_TG, - self::LANGUAGE_TG_TJ, - self::LANGUAGE_TH, - self::LANGUAGE_TH_TH, - self::LANGUAGE_TI, - self::LANGUAGE_TI_ER, - self::LANGUAGE_TI_ET, - self::LANGUAGE_TK, - self::LANGUAGE_TK_TM, - self::LANGUAGE_TL, - self::LANGUAGE_TN, - self::LANGUAGE_TN_BW, - self::LANGUAGE_TN_ZA, - self::LANGUAGE_TO, - self::LANGUAGE_TO_TO, - self::LANGUAGE_TOK, - self::LANGUAGE_TOK_001, - self::LANGUAGE_TR, - self::LANGUAGE_TR_CY, - self::LANGUAGE_TR_TR, - self::LANGUAGE_TS, - self::LANGUAGE_TT, - self::LANGUAGE_TT_RU, - self::LANGUAGE_TW, - self::LANGUAGE_TWQ, - self::LANGUAGE_TWQ_NE, - self::LANGUAGE_TY, - self::LANGUAGE_TZM, - self::LANGUAGE_TZM_MA, - self::LANGUAGE_UG, - self::LANGUAGE_UG_CN, - self::LANGUAGE_UK, - self::LANGUAGE_UK_UA, - self::LANGUAGE_UR, - self::LANGUAGE_UR_IN, - self::LANGUAGE_UR_PK, - self::LANGUAGE_UZ, - self::LANGUAGE_UZ_AF, - self::LANGUAGE_UZ_UZ, - self::LANGUAGE_VAI, - self::LANGUAGE_VAI_LR, - self::LANGUAGE_VE, - self::LANGUAGE_VEC, - self::LANGUAGE_VEC_IT, - self::LANGUAGE_VI, - self::LANGUAGE_VI_VN, - self::LANGUAGE_VMW, - self::LANGUAGE_VMW_MZ, - self::LANGUAGE_VO, - self::LANGUAGE_VO_001, - self::LANGUAGE_VUN, - self::LANGUAGE_VUN_TZ, - self::LANGUAGE_WA, - self::LANGUAGE_WAE, - self::LANGUAGE_WAE_CH, - self::LANGUAGE_WO, - self::LANGUAGE_WO_SN, - self::LANGUAGE_XH, - self::LANGUAGE_XH_ZA, - self::LANGUAGE_XNR, - self::LANGUAGE_XNR_IN, - self::LANGUAGE_XOG, - self::LANGUAGE_XOG_UG, - self::LANGUAGE_YAV, - self::LANGUAGE_YAV_CM, - self::LANGUAGE_YI, - self::LANGUAGE_YI_001, - self::LANGUAGE_YI_UA, - self::LANGUAGE_YO, - self::LANGUAGE_YO_BJ, - self::LANGUAGE_YO_NG, - self::LANGUAGE_YRL, - self::LANGUAGE_YRL_BR, - self::LANGUAGE_YRL_CO, - self::LANGUAGE_YRL_VE, - self::LANGUAGE_YUE, - self::LANGUAGE_YUE_CN, - self::LANGUAGE_YUE_HK, - self::LANGUAGE_YUE_MO, - self::LANGUAGE_ZA, - self::LANGUAGE_ZA_CN, - self::LANGUAGE_ZGH, - self::LANGUAGE_ZGH_MA, - self::LANGUAGE_ZH, - self::LANGUAGE_ZH_CN, - self::LANGUAGE_ZH_HANS, - self::LANGUAGE_ZH_HANT, - self::LANGUAGE_ZH_HK, - self::LANGUAGE_ZH_MO, - self::LANGUAGE_ZH_MY, - self::LANGUAGE_ZH_SG, - self::LANGUAGE_ZH_TW, - self::LANGUAGE_ZU, - self::LANGUAGE_ZU_ZA, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_BLOG_POST, - self::TYPE_KNOWLEDGE_ARTICLE, - self::TYPE_LANDING_PAGE, - self::TYPE_LISTING_PAGE, - self::TYPE_SITE_PAGE, - self::TYPE_STRUCTURED_CONTENT, - ]; - } - - /** - * 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('author_full_name', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('combined_id', $data ?? [], null); - $this->setIfExists('content_type', $data ?? [], null); - $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('domain', $data ?? [], null); - $this->setIfExists('featured_image_url', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('in_beta', $data ?? [], null); - $this->setIfExists('is_private', $data ?? [], null); - $this->setIfExists('language', $data ?? [], null); - $this->setIfExists('published_date', $data ?? [], null); - $this->setIfExists('row_id', $data ?? [], null); - $this->setIfExists('score', $data ?? [], null); - $this->setIfExists('subcategory', $data ?? [], null); - $this->setIfExists('table_id', $data ?? [], null); - $this->setIfExists('tags', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('type', $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['domain'] === null) { - $invalidProperties[] = "'domain' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - $allowedValues = $this->getLanguageAllowableValues(); - if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'language', must be one of '%s'", - $this->container['language'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['score'] === null) { - $invalidProperties[] = "'score' can't be null"; - } - 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['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 author_full_name - * - * @return string|null - */ - public function getAuthorFullName() - { - return $this->container['author_full_name']; - } - - /** - * Sets author_full_name - * - * @param string|null $author_full_name Name of the author. - * - * @return self - */ - public function setAuthorFullName($author_full_name) - { - if (is_null($author_full_name)) { - throw new \InvalidArgumentException('non-nullable author_full_name cannot be null'); - } - $this->container['author_full_name'] = $author_full_name; - - return $this; - } - - /** - * Gets category - * - * @return string|null - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string|null $category The error 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; - } - - /** - * Gets combined_id - * - * @return string|null - */ - public function getCombinedId() - { - return $this->container['combined_id']; - } - - /** - * Sets combined_id - * - * @param string|null $combined_id The ID of the document in HubSpot. - * - * @return self - */ - public function setCombinedId($combined_id) - { - if (is_null($combined_id)) { - throw new \InvalidArgumentException('non-nullable combined_id cannot be null'); - } - $this->container['combined_id'] = $combined_id; - - return $this; - } - - /** - * Gets content_type - * - * @return string|null - */ - public function getContentType() - { - return $this->container['content_type']; - } - - /** - * Sets content_type - * - * @param string|null $content_type content_type - * - * @return self - */ - public function setContentType($content_type) - { - if (is_null($content_type)) { - throw new \InvalidArgumentException('non-nullable content_type cannot be null'); - } - $this->container['content_type'] = $content_type; - - return $this; - } - - /** - * Gets description - * - * @return string|null - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string|null $description The result's description. The content will be determined by the value of `length` in the request. - * - * @return self - */ - public function setDescription($description) - { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); - } - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets domain - * - * @return string - */ - public function getDomain() - { - return $this->container['domain']; - } - - /** - * Sets domain - * - * @param string $domain The domain the document is hosted on. - * - * @return self - */ - public function setDomain($domain) - { - if (is_null($domain)) { - throw new \InvalidArgumentException('non-nullable domain cannot be null'); - } - $this->container['domain'] = $domain; - - return $this; - } - - /** - * Gets featured_image_url - * - * @return string|null - */ - public function getFeaturedImageUrl() - { - return $this->container['featured_image_url']; - } - - /** - * Sets featured_image_url - * - * @param string|null $featured_image_url URL of the featured image. - * - * @return self - */ - public function setFeaturedImageUrl($featured_image_url) - { - if (is_null($featured_image_url)) { - throw new \InvalidArgumentException('non-nullable featured_image_url cannot be null'); - } - $this->container['featured_image_url'] = $featured_image_url; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id The ID of the content. - * - * @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 in_beta - * - * @return bool|null - */ - public function getInBeta() - { - return $this->container['in_beta']; - } - - /** - * Sets in_beta - * - * @param bool|null $in_beta in_beta - * - * @return self - */ - public function setInBeta($in_beta) - { - if (is_null($in_beta)) { - throw new \InvalidArgumentException('non-nullable in_beta cannot be null'); - } - $this->container['in_beta'] = $in_beta; - - return $this; - } - - /** - * Gets is_private - * - * @return bool|null - */ - public function getIsPrivate() - { - return $this->container['is_private']; - } - - /** - * Sets is_private - * - * @param bool|null $is_private is_private - * - * @return self - */ - public function setIsPrivate($is_private) - { - if (is_null($is_private)) { - throw new \InvalidArgumentException('non-nullable is_private cannot be null'); - } - $this->container['is_private'] = $is_private; - - return $this; - } - - /** - * Gets language - * - * @return string|null - */ - public function getLanguage() - { - return $this->container['language']; - } - - /** - * Sets language - * - * @param string|null $language The document's language. - * - * @return self - */ - public function setLanguage($language) - { - if (is_null($language)) { - throw new \InvalidArgumentException('non-nullable language cannot be null'); - } - $allowedValues = $this->getLanguageAllowableValues(); - if (!in_array($language, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'language', must be one of '%s'", - $language, - implode("', '", $allowedValues) - ) - ); - } - $this->container['language'] = $language; - - return $this; - } - - /** - * Gets published_date - * - * @return int|null - */ - public function getPublishedDate() - { - return $this->container['published_date']; - } - - /** - * Sets published_date - * - * @param int|null $published_date The date the content was published. - * - * @return self - */ - public function setPublishedDate($published_date) - { - if (is_null($published_date)) { - throw new \InvalidArgumentException('non-nullable published_date cannot be null'); - } - $this->container['published_date'] = $published_date; - - return $this; - } - - /** - * Gets row_id - * - * @return int|null - */ - public function getRowId() - { - return $this->container['row_id']; - } - - /** - * Sets row_id - * - * @param int|null $row_id If a dynamic page, the row ID in the HubDB table. - * - * @return self - */ - public function setRowId($row_id) - { - if (is_null($row_id)) { - throw new \InvalidArgumentException('non-nullable row_id cannot be null'); - } - $this->container['row_id'] = $row_id; - - return $this; - } - - /** - * Gets score - * - * @return float - */ - public function getScore() - { - return $this->container['score']; - } - - /** - * Sets score - * - * @param float $score The matching score of the document. - * - * @return self - */ - public function setScore($score) - { - if (is_null($score)) { - throw new \InvalidArgumentException('non-nullable score cannot be null'); - } - $this->container['score'] = $score; - - return $this; - } - - /** - * Gets subcategory - * - * @return string|null - */ - public function getSubcategory() - { - return $this->container['subcategory']; - } - - /** - * Sets subcategory - * - * @param string|null $subcategory For knowledge articles, the subcategory of the article. - * - * @return self - */ - public function setSubcategory($subcategory) - { - if (is_null($subcategory)) { - throw new \InvalidArgumentException('non-nullable subcategory cannot be null'); - } - $this->container['subcategory'] = $subcategory; - - return $this; - } - - /** - * Gets table_id - * - * @return int|null - */ - public function getTableId() - { - return $this->container['table_id']; - } - - /** - * Sets table_id - * - * @param int|null $table_id If a dynamic page, the ID of the HubDB table. - * - * @return self - */ - public function setTableId($table_id) - { - if (is_null($table_id)) { - throw new \InvalidArgumentException('non-nullable table_id cannot be null'); - } - $this->container['table_id'] = $table_id; - - return $this; - } - - /** - * Gets tags - * - * @return string[]|null - */ - public function getTags() - { - return $this->container['tags']; - } - - /** - * Sets tags - * - * @param string[]|null $tags If a blog post, the tags associated with it. - * - * @return self - */ - public function setTags($tags) - { - if (is_null($tags)) { - throw new \InvalidArgumentException('non-nullable tags cannot be null'); - } - $this->container['tags'] = $tags; - - return $this; - } - - /** - * Gets title - * - * @return string|null - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string|null $title The title of the returned document. - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The type of document. Can be `SITE_PAGE`, `LANDING_PAGE`, `BLOG_POST`, `LISTING_PAGE`, or `KNOWLEDGE_ARTICLE`. - * - * @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 url - * - * @return string - */ - public function getUrl() - { - return $this->container['url']; - } - - /** - * Sets url - * - * @param string $url The url of the document. - * - * @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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/SiteSearch/Model/PublicSearchResults.php b/codegen/Cms/SiteSearch/Model/PublicSearchResults.php deleted file mode 100644 index 197bc1fb..00000000 --- a/codegen/Cms/SiteSearch/Model/PublicSearchResults.php +++ /dev/null @@ -1,594 +0,0 @@ - - */ -class PublicSearchResults implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicSearchResults'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'limit' => 'int', - 'offset' => 'int', - 'page' => 'int', - 'results' => '\HubSpot\Client\Cms\SiteSearch\Model\ContentSearchResult[]', - 'search_term' => 'string', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'limit' => 'int32', - 'offset' => 'int32', - 'page' => 'int32', - 'results' => null, - 'search_term' => null, - 'total' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'limit' => false, - 'offset' => false, - 'page' => false, - 'results' => false, - 'search_term' => false, - 'total' => 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 = [ - 'limit' => 'limit', - 'offset' => 'offset', - 'page' => 'page', - 'results' => 'results', - 'search_term' => 'searchTerm', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'limit' => 'setLimit', - 'offset' => 'setOffset', - 'page' => 'setPage', - 'results' => 'setResults', - 'search_term' => 'setSearchTerm', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'limit' => 'getLimit', - 'offset' => 'getOffset', - 'page' => 'getPage', - 'results' => 'getResults', - 'search_term' => 'getSearchTerm', - 'total' => 'getTotal' - ]; - - /** - * 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('limit', $data ?? [], null); - $this->setIfExists('offset', $data ?? [], null); - $this->setIfExists('page', $data ?? [], null); - $this->setIfExists('results', $data ?? [], null); - $this->setIfExists('search_term', $data ?? [], null); - $this->setIfExists('total', $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['limit'] === null) { - $invalidProperties[] = "'limit' can't be null"; - } - if ($this->container['offset'] === null) { - $invalidProperties[] = "'offset' can't be null"; - } - if ($this->container['page'] === null) { - $invalidProperties[] = "'page' can't be null"; - } - if ($this->container['results'] === null) { - $invalidProperties[] = "'results' can't be null"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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 limit - * - * @return int - */ - public function getLimit() - { - return $this->container['limit']; - } - - /** - * Sets limit - * - * @param int $limit The number of results returned in a single response. - * - * @return self - */ - public function setLimit($limit) - { - if (is_null($limit)) { - throw new \InvalidArgumentException('non-nullable limit cannot be null'); - } - $this->container['limit'] = $limit; - - return $this; - } - - /** - * Gets offset - * - * @return int - */ - public function getOffset() - { - return $this->container['offset']; - } - - /** - * Sets offset - * - * @param int $offset The starting point for the next set of results in pagination. - * - * @return self - */ - public function setOffset($offset) - { - if (is_null($offset)) { - throw new \InvalidArgumentException('non-nullable offset cannot be null'); - } - $this->container['offset'] = $offset; - - return $this; - } - - /** - * Gets page - * - * @return int - */ - public function getPage() - { - return $this->container['page']; - } - - /** - * Sets page - * - * @param int $page The current page number in the paginated results. - * - * @return self - */ - public function setPage($page) - { - if (is_null($page)) { - throw new \InvalidArgumentException('non-nullable page cannot be null'); - } - $this->container['page'] = $page; - - return $this; - } - - /** - * Gets results - * - * @return \HubSpot\Client\Cms\SiteSearch\Model\ContentSearchResult[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Cms\SiteSearch\Model\ContentSearchResult[] $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 search_term - * - * @return string|null - */ - public function getSearchTerm() - { - return $this->container['search_term']; - } - - /** - * Sets search_term - * - * @param string|null $search_term The term used in the search query. - * - * @return self - */ - public function setSearchTerm($search_term) - { - if (is_null($search_term)) { - throw new \InvalidArgumentException('non-nullable search_term cannot be null'); - } - $this->container['search_term'] = $search_term; - - return $this; - } - - /** - * Gets total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total The total number of results found for the search term. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/SourceCode/Api/AdvancedApi.php b/codegen/Cms/SourceCode/Api/AdvancedApi.php index 5e33e1e5..359fad22 100644 --- a/codegen/Cms/SourceCode/Api/AdvancedApi.php +++ b/codegen/Cms/SourceCode/Api/AdvancedApi.php @@ -433,7 +433,7 @@ public function createRequest($environment, $path, $file = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -758,7 +758,7 @@ public function createOrUpdateRequest($environment, $path, $file = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1022,7 +1022,7 @@ public function doAsyncRequest($file_extract_request, string $contentType = self if (isset($file_extract_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($file_extract_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $file_extract_request; } @@ -1043,7 +1043,7 @@ public function doAsyncRequest($file_extract_request, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1357,7 +1357,7 @@ public function doValidateRequest($environment, $path, $file = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1643,7 +1643,7 @@ public function getAsyncStatusRequest($task_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SourceCode/Api/BasicApi.php b/codegen/Cms/SourceCode/Api/BasicApi.php index a54878c5..f94b429a 100644 --- a/codegen/Cms/SourceCode/Api/BasicApi.php +++ b/codegen/Cms/SourceCode/Api/BasicApi.php @@ -350,7 +350,7 @@ public function archiveRequest($environment, $path, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -645,7 +645,7 @@ public function downloadRequest($environment, $path, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -969,7 +969,7 @@ public function getRequest($environment, $path, $properties = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SourceCode/Api/ContentApi.php b/codegen/Cms/SourceCode/Api/ContentApi.php deleted file mode 100644 index b164e362..00000000 --- a/codegen/Cms/SourceCode/Api/ContentApi.php +++ /dev/null @@ -1,1423 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'multipart/form-data', - ], - 'createOrUpdate' => [ - 'multipart/form-data', - ], - 'download' => [ - '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 file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['archive'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($environment, $path, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($environment, $path, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['archive'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($environment, $path, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($environment, $path, $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\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a file - * - * @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 $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($environment, $path, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($environment, $path, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a file - * - * @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 $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($environment, $path, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($environment, $path, $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 $environment The environment of the file (\"draft\" or \"published\"). (required) - * @param string $path The file system location of the file. (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($environment, $path, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling archive' - ); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling archive' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling ContentApi.archive, must conform to the pattern /.+/."); - } - - - $resourcePath = '/cms/v3/source-code/{environment}/content/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $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 a file - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error - * @deprecated - */ - public function create($environment, $path, $file = null, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($environment, $path, $file, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a file - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function createWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($environment, $path, $file, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a file - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function createAsync($environment, $path, $file = null, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($environment, $path, $file, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a file - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function createAsyncWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; - $request = $this->createRequest($environment, $path, $file, $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 string $environment The environment of the file (\"draft\" or \"published\"). (required) - * @param string $path The file system location of the file. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - * @deprecated - */ - public function createRequest($environment, $path, $file = null, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling create' - ); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling create' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling ContentApi.create, must conform to the pattern /.+/."); - } - - - - $resourcePath = '/cms/v3/source-code/{environment}/content/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $resourcePath - ); - } - - // form params - $formDataProcessor = new FormDataProcessor(); - - $formData = $formDataProcessor->prepare([ - 'file' => $file, - ]); - - $formParams = $formDataProcessor->flatten($formData); - $multipart = $formDataProcessor->has_file; - - $multipart = true; - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createOrUpdate - * - * Create or update a file - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function createOrUpdate($environment, $path, $file = null, string $contentType = self::contentTypes['createOrUpdate'][0]) - { - list($response) = $this->createOrUpdateWithHttpInfo($environment, $path, $file, $contentType); - return $response; - } - - /** - * Operation createOrUpdateWithHttpInfo - * - * Create or update a file - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createOrUpdateWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['createOrUpdate'][0]) - { - $request = $this->createOrUpdateRequest($environment, $path, $file, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createOrUpdateAsync - * - * Create or update a file - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrUpdateAsync($environment, $path, $file = null, string $contentType = self::contentTypes['createOrUpdate'][0]) - { - return $this->createOrUpdateAsyncWithHttpInfo($environment, $path, $file, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createOrUpdateAsyncWithHttpInfo - * - * Create or update a file - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createOrUpdateAsyncWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['createOrUpdate'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; - $request = $this->createOrUpdateRequest($environment, $path, $file, $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 'createOrUpdate' - * - * @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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function createOrUpdateRequest($environment, $path, $file = null, string $contentType = self::contentTypes['createOrUpdate'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling createOrUpdate' - ); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling createOrUpdate' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling ContentApi.createOrUpdate, must conform to the pattern /.+/."); - } - - - - $resourcePath = '/cms/v3/source-code/{environment}/content/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $resourcePath - ); - } - - // form params - $formDataProcessor = new FormDataProcessor(); - - $formData = $formDataProcessor->prepare([ - 'file' => $file, - ]); - - $formParams = $formDataProcessor->flatten($formData); - $multipart = $formDataProcessor->has_file; - - $multipart = true; - $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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation download - * - * Download a file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['download'] 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 - * @throws \InvalidArgumentException - * @return \SplFileObject|\HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function download($environment, $path, string $contentType = self::contentTypes['download'][0]) - { - list($response) = $this->downloadWithHttpInfo($environment, $path, $contentType); - return $response; - } - - /** - * Operation downloadWithHttpInfo - * - * Download a file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['download'] 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 - * @throws \InvalidArgumentException - * @return array of \SplFileObject|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function downloadWithHttpInfo($environment, $path, string $contentType = self::contentTypes['download'][0]) - { - $request = $this->downloadRequest($environment, $path, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\SplFileObject', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\SplFileObject', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\SplFileObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation downloadAsync - * - * Download a file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function downloadAsync($environment, $path, string $contentType = self::contentTypes['download'][0]) - { - return $this->downloadAsyncWithHttpInfo($environment, $path, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation downloadAsyncWithHttpInfo - * - * Download a file - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function downloadAsyncWithHttpInfo($environment, $path, string $contentType = self::contentTypes['download'][0]) - { - $returnType = '\SplFileObject'; - $request = $this->downloadRequest($environment, $path, $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 'download' - * - * @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 $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function downloadRequest($environment, $path, string $contentType = self::contentTypes['download'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling download' - ); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling download' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling ContentApi.download, must conform to the pattern /.+/."); - } - - - $resourcePath = '/cms/v3/source-code/{environment}/content/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/octet-stream', '*/*', ], - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/SourceCode/Api/ExtractApi.php b/codegen/Cms/SourceCode/Api/ExtractApi.php deleted file mode 100644 index bbe1377b..00000000 --- a/codegen/Cms/SourceCode/Api/ExtractApi.php +++ /dev/null @@ -1,771 +0,0 @@ - [ - 'application/json', - ], - 'getAsyncStatus' => [ - '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 doAsync - * - * Extract a zip file - * - * @param \HubSpot\Client\Cms\SourceCode\Model\FileExtractRequest $file_extract_request file_extract_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doAsync'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\TaskLocator|\HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function doAsync($file_extract_request, string $contentType = self::contentTypes['doAsync'][0]) - { - list($response) = $this->doAsyncWithHttpInfo($file_extract_request, $contentType); - return $response; - } - - /** - * Operation doAsyncWithHttpInfo - * - * Extract a zip file - * - * @param \HubSpot\Client\Cms\SourceCode\Model\FileExtractRequest $file_extract_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doAsync'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\TaskLocator|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doAsyncWithHttpInfo($file_extract_request, string $contentType = self::contentTypes['doAsync'][0]) - { - $request = $this->doAsyncRequest($file_extract_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 202: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\TaskLocator', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\TaskLocator', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\TaskLocator', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation doAsyncAsync - * - * Extract a zip file - * - * @param \HubSpot\Client\Cms\SourceCode\Model\FileExtractRequest $file_extract_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doAsync'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doAsyncAsync($file_extract_request, string $contentType = self::contentTypes['doAsync'][0]) - { - return $this->doAsyncAsyncWithHttpInfo($file_extract_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation doAsyncAsyncWithHttpInfo - * - * Extract a zip file - * - * @param \HubSpot\Client\Cms\SourceCode\Model\FileExtractRequest $file_extract_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doAsync'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doAsyncAsyncWithHttpInfo($file_extract_request, string $contentType = self::contentTypes['doAsync'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\TaskLocator'; - $request = $this->doAsyncRequest($file_extract_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 'doAsync' - * - * @param \HubSpot\Client\Cms\SourceCode\Model\FileExtractRequest $file_extract_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doAsync'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function doAsyncRequest($file_extract_request, string $contentType = self::contentTypes['doAsync'][0]) - { - - // verify the required parameter 'file_extract_request' is set - if ($file_extract_request === null || (is_array($file_extract_request) && count($file_extract_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $file_extract_request when calling doAsync' - ); - } - - - $resourcePath = '/cms/v3/source-code/extract/async'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($file_extract_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($file_extract_request)); - } else { - $httpBody = $file_extract_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 getAsyncStatus - * - * Get extraction status - * - * @param int $task_id The extraction task ID returned by the initial `extract/async` request. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncStatus'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\ActionResponse|\HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function getAsyncStatus($task_id, string $contentType = self::contentTypes['getAsyncStatus'][0]) - { - list($response) = $this->getAsyncStatusWithHttpInfo($task_id, $contentType); - return $response; - } - - /** - * Operation getAsyncStatusWithHttpInfo - * - * Get extraction status - * - * @param int $task_id The extraction task ID returned by the initial `extract/async` request. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncStatus'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\ActionResponse|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAsyncStatusWithHttpInfo($task_id, string $contentType = self::contentTypes['getAsyncStatus'][0]) - { - $request = $this->getAsyncStatusRequest($task_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\ActionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\ActionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\ActionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAsyncStatusAsync - * - * Get extraction status - * - * @param int $task_id The extraction task ID returned by the initial `extract/async` request. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncStatusAsync($task_id, string $contentType = self::contentTypes['getAsyncStatus'][0]) - { - return $this->getAsyncStatusAsyncWithHttpInfo($task_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAsyncStatusAsyncWithHttpInfo - * - * Get extraction status - * - * @param int $task_id The extraction task ID returned by the initial `extract/async` request. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncStatusAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['getAsyncStatus'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\ActionResponse'; - $request = $this->getAsyncStatusRequest($task_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 'getAsyncStatus' - * - * @param int $task_id The extraction task ID returned by the initial `extract/async` request. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getAsyncStatusRequest($task_id, string $contentType = self::contentTypes['getAsyncStatus'][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 $task_id when calling getAsyncStatus' - ); - } - - - $resourcePath = '/cms/v3/source-code/extract/async/tasks/{taskId}/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($task_id !== null) { - $resourcePath = str_replace( - '{' . 'taskId' . '}', - ObjectSerializer::toPathValue($task_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/SourceCode/Api/MetadataApi.php b/codegen/Cms/SourceCode/Api/MetadataApi.php deleted file mode 100644 index e2f2847d..00000000 --- a/codegen/Cms/SourceCode/Api/MetadataApi.php +++ /dev/null @@ -1,521 +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, - 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 get - * - * Get the metadata for a file - * - * @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|null $properties environment: Either \"draft\" or \"published\", decides what version of the asset to return path: the path of the CMS asset being downloaded (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function get($environment, $path, $properties = null, string $contentType = self::contentTypes['get'][0]) - { - list($response) = $this->getWithHttpInfo($environment, $path, $properties, $contentType); - return $response; - } - - /** - * Operation getWithHttpInfo - * - * Get the metadata for a file - * - * @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|null $properties environment: Either \"draft\" or \"published\", decides what version of the asset to return path: the path of the CMS asset being downloaded (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata|\HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getWithHttpInfo($environment, $path, $properties = null, string $contentType = self::contentTypes['get'][0]) - { - $request = $this->getRequest($environment, $path, $properties, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAsync - * - * Get the metadata for a file - * - * @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|null $properties environment: Either \"draft\" or \"published\", decides what version of the asset to return path: the path of the CMS asset being downloaded (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsync($environment, $path, $properties = null, string $contentType = self::contentTypes['get'][0]) - { - return $this->getAsyncWithHttpInfo($environment, $path, $properties, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAsyncWithHttpInfo - * - * Get the metadata for a file - * - * @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|null $properties environment: Either \"draft\" or \"published\", decides what version of the asset to return path: the path of the CMS asset being downloaded (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncWithHttpInfo($environment, $path, $properties = null, string $contentType = self::contentTypes['get'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; - $request = $this->getRequest($environment, $path, $properties, $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 'get' - * - * @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|null $properties environment: Either \"draft\" or \"published\", decides what version of the asset to return path: the path of the CMS asset being downloaded (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getRequest($environment, $path, $properties = null, string $contentType = self::contentTypes['get'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling get' - ); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling get' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling MetadataApi.get, must conform to the pattern /.+/."); - } - - - - $resourcePath = '/cms/v3/source-code/{environment}/metadata/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties, - 'properties', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/SourceCode/Api/ValidationApi.php b/codegen/Cms/SourceCode/Api/ValidationApi.php deleted file mode 100644 index 66dbbce0..00000000 --- a/codegen/Cms/SourceCode/Api/ValidationApi.php +++ /dev/null @@ -1,511 +0,0 @@ - [ - 'multipart/form-data', - ], - ]; - - /** - * @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 doValidate - * - * Validate the contents of a file - * - * @param string $environment environment (required) - * @param string $path The file system location of the file. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\SourceCode\Model\Error - */ - public function doValidate($environment, $path, $file = null, string $contentType = self::contentTypes['doValidate'][0]) - { - list($response) = $this->doValidateWithHttpInfo($environment, $path, $file, $contentType); - return $response; - } - - /** - * Operation doValidateWithHttpInfo - * - * Validate the contents of a file - * - * @param string $environment (required) - * @param string $path The file system location of the file. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\SourceCode\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doValidateWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['doValidate'][0]) - { - $request = $this->doValidateRequest($environment, $path, $file, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\SourceCode\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation doValidateAsync - * - * Validate the contents of a file - * - * @param string $environment (required) - * @param string $path The file system location of the file. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doValidateAsync($environment, $path, $file = null, string $contentType = self::contentTypes['doValidate'][0]) - { - return $this->doValidateAsyncWithHttpInfo($environment, $path, $file, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation doValidateAsyncWithHttpInfo - * - * Validate the contents of a file - * - * @param string $environment (required) - * @param string $path The file system location of the file. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doValidateAsyncWithHttpInfo($environment, $path, $file = null, string $contentType = self::contentTypes['doValidate'][0]) - { - $returnType = '\HubSpot\Client\Cms\SourceCode\Model\Error'; - $request = $this->doValidateRequest($environment, $path, $file, $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 'doValidate' - * - * @param string $environment (required) - * @param string $path The file system location of the file. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function doValidateRequest($environment, $path, $file = null, string $contentType = self::contentTypes['doValidate'][0]) - { - - // verify the required parameter 'environment' is set - if ($environment === null || (is_array($environment) && count($environment) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $environment when calling doValidate' - ); - } - if (!preg_match("/.+/", $environment)) { - throw new \InvalidArgumentException("invalid value for \"environment\" when calling ValidationApi.doValidate, must conform to the pattern /.+/."); - } - - // verify the required parameter 'path' is set - if ($path === null || (is_array($path) && count($path) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $path when calling doValidate' - ); - } - if (!preg_match("/.+/", $path)) { - throw new \InvalidArgumentException("invalid value for \"path\" when calling ValidationApi.doValidate, must conform to the pattern /.+/."); - } - - - - $resourcePath = '/cms/v3/source-code/{environment}/validate/{path}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($environment !== null) { - $resourcePath = str_replace( - '{' . 'environment' . '}', - ObjectSerializer::toPathValue($environment), - $resourcePath - ); - } - // path params - if ($path !== null) { - $resourcePath = str_replace( - '{' . 'path' . '}', - ObjectSerializer::toPathValue($path), - $resourcePath - ); - } - - // form params - $formDataProcessor = new FormDataProcessor(); - - $formData = $formDataProcessor->prepare([ - 'file' => $file, - ]); - - $formParams = $formDataProcessor->flatten($formData); - $multipart = $formDataProcessor->has_file; - - $multipart = true; - $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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Cms/UrlRedirects/Api/BasicApi.php b/codegen/Cms/UrlRedirects/Api/BasicApi.php index 6237872c..67adced7 100644 --- a/codegen/Cms/UrlRedirects/Api/BasicApi.php +++ b/codegen/Cms/UrlRedirects/Api/BasicApi.php @@ -79,18 +79,6 @@ class BasicApi 'cmsUrlRedirectsV3' => [ 'application/json', ], - 'cmsUrlRedirectsV3UrlMappings' => [ - 'application/json', - ], - 'cmsUrlRedirectsV3UrlMappingsId' => [ - 'application/json', - ], - 'cmsUrlRedirectsV3UrlMappingsId_0' => [ - 'application/json', - ], - 'cmsUrlRedirectsV3UrlMappings_0' => [ - 'application/json', - ], 'cmsUrlRedirectsV3_0' => [ 'application/json', ], @@ -345,7 +333,7 @@ public function archiveRequest($url_redirect_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -753,265 +741,7 @@ public function cmsUrlRedirectsV3Request($after = null, $archived = null, $creat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); - } 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 cmsUrlRedirectsV3UrlMappings - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]|\HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function cmsUrlRedirectsV3UrlMappings(string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings'][0]) - { - list($response) = $this->cmsUrlRedirectsV3UrlMappingsWithHttpInfo($contentType); - return $response; - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]|\HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function cmsUrlRedirectsV3UrlMappingsWithHttpInfo(string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings'][0]) - { - $request = $this->cmsUrlRedirectsV3UrlMappingsRequest($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(), - (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, - (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null - ); - } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsAsync(string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings'][0]) - { - return $this->cmsUrlRedirectsV3UrlMappingsAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsAsyncWithHttpInfo(string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping[]'; - $request = $this->cmsUrlRedirectsV3UrlMappingsRequest($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 = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; - $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response ? $response->getHeaders() : [], - $response ? (string) $response->getBody() : '' - ); - } - ); - } - - /** - * Create request for operation 'cmsUrlRedirectsV3UrlMappings' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cmsUrlRedirectsV3UrlMappingsRequest(string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings'][0]) - { - - - $resourcePath = '/cms/url-redirects/v3/url-mappings'; - $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 = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1044,775 +774,6 @@ public function cmsUrlRedirectsV3UrlMappingsRequest(string $contentType = self:: ); } - /** - * Operation cmsUrlRedirectsV3UrlMappingsId - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function cmsUrlRedirectsV3UrlMappingsId($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'][0]) - { - list($response) = $this->cmsUrlRedirectsV3UrlMappingsIdWithHttpInfo($id, $contentType); - return $response; - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsIdWithHttpInfo - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function cmsUrlRedirectsV3UrlMappingsIdWithHttpInfo($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'][0]) - { - $request = $this->cmsUrlRedirectsV3UrlMappingsIdRequest($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(), - (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, - (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null - ); - } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsIdAsync - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsIdAsync($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'][0]) - { - return $this->cmsUrlRedirectsV3UrlMappingsIdAsyncWithHttpInfo($id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsIdAsyncWithHttpInfo - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsIdAsyncWithHttpInfo($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; - $request = $this->cmsUrlRedirectsV3UrlMappingsIdRequest($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 = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; - $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response ? $response->getHeaders() : [], - $response ? (string) $response->getBody() : '' - ); - } - ); - } - - /** - * Create request for operation 'cmsUrlRedirectsV3UrlMappingsId' - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cmsUrlRedirectsV3UrlMappingsIdRequest($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId'][0]) - { - - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling cmsUrlRedirectsV3UrlMappingsId' - ); - } - if (!preg_match("/\\d+/", $id)) { - throw new \InvalidArgumentException("invalid value for \"id\" when calling BasicApi.cmsUrlRedirectsV3UrlMappingsId, must conform to the pattern /\\d+/."); - } - - - $resourcePath = '/cms/url-redirects/v3/url-mappings/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($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 = json_encode($formParams, JSON_THROW_ON_ERROR); - } 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 cmsUrlRedirectsV3UrlMappingsId_0 - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function cmsUrlRedirectsV3UrlMappingsId_0($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'][0]) - { - $this->cmsUrlRedirectsV3UrlMappingsId_0WithHttpInfo($id, $contentType); - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsId_0WithHttpInfo - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function cmsUrlRedirectsV3UrlMappingsId_0WithHttpInfo($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'][0]) - { - $request = $this->cmsUrlRedirectsV3UrlMappingsId_0Request($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(), - (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, - (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null - ); - } catch (\Psr\Http\Client\NetworkExceptionInterface $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\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsId_0Async - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsId_0Async($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'][0]) - { - return $this->cmsUrlRedirectsV3UrlMappingsId_0AsyncWithHttpInfo($id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cmsUrlRedirectsV3UrlMappingsId_0AsyncWithHttpInfo - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappingsId_0AsyncWithHttpInfo($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'][0]) - { - $returnType = ''; - $request = $this->cmsUrlRedirectsV3UrlMappingsId_0Request($id, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; - $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response ? $response->getHeaders() : [], - $response ? (string) $response->getBody() : '' - ); - } - ); - } - - /** - * Create request for operation 'cmsUrlRedirectsV3UrlMappingsId_0' - * - * @param int $id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cmsUrlRedirectsV3UrlMappingsId_0Request($id, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappingsId_0'][0]) - { - - // verify the required parameter 'id' is set - if ($id === null || (is_array($id) && count($id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling cmsUrlRedirectsV3UrlMappingsId_0' - ); - } - if (!preg_match("/\\d+/", $id)) { - throw new \InvalidArgumentException("invalid value for \"id\" when calling BasicApi.cmsUrlRedirectsV3UrlMappingsId_0, must conform to the pattern /\\d+/."); - } - - - $resourcePath = '/cms/url-redirects/v3/url-mappings/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($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 = json_encode($formParams, JSON_THROW_ON_ERROR); - } 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 cmsUrlRedirectsV3UrlMappings_0 - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping url_mapping (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function cmsUrlRedirectsV3UrlMappings_0($url_mapping, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'][0]) - { - list($response) = $this->cmsUrlRedirectsV3UrlMappings_0WithHttpInfo($url_mapping, $contentType); - return $response; - } - - /** - * Operation cmsUrlRedirectsV3UrlMappings_0WithHttpInfo - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function cmsUrlRedirectsV3UrlMappings_0WithHttpInfo($url_mapping, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'][0]) - { - $request = $this->cmsUrlRedirectsV3UrlMappings_0Request($url_mapping, $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(), - (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, - (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null - ); - } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cmsUrlRedirectsV3UrlMappings_0Async - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappings_0Async($url_mapping, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'][0]) - { - return $this->cmsUrlRedirectsV3UrlMappings_0AsyncWithHttpInfo($url_mapping, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cmsUrlRedirectsV3UrlMappings_0AsyncWithHttpInfo - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cmsUrlRedirectsV3UrlMappings_0AsyncWithHttpInfo($url_mapping, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\Error'; - $request = $this->cmsUrlRedirectsV3UrlMappings_0Request($url_mapping, $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 = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; - $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response ? $response->getHeaders() : [], - $response ? (string) $response->getBody() : '' - ); - } - ); - } - - /** - * Create request for operation 'cmsUrlRedirectsV3UrlMappings_0' - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cmsUrlRedirectsV3UrlMappings_0Request($url_mapping, string $contentType = self::contentTypes['cmsUrlRedirectsV3UrlMappings_0'][0]) - { - - // verify the required parameter 'url_mapping' is set - if ($url_mapping === null || (is_array($url_mapping) && count($url_mapping) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_mapping when calling cmsUrlRedirectsV3UrlMappings_0' - ); - } - - - $resourcePath = '/cms/url-redirects/v3/url-mappings'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($url_mapping)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($url_mapping), JSON_THROW_ON_ERROR); - } else { - $httpBody = $url_mapping; - } - } 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 = json_encode($formParams, JSON_THROW_ON_ERROR); - } 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 cmsUrlRedirectsV3_0 * @@ -2036,7 +997,7 @@ public function cmsUrlRedirectsV3_0Request($url_mapping_create_request_body, str if (isset($url_mapping_create_request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($url_mapping_create_request_body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $url_mapping_create_request_body; } @@ -2057,7 +1018,7 @@ public function cmsUrlRedirectsV3_0Request($url_mapping_create_request_body, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2343,7 +1304,7 @@ public function getByIdRequest($url_redirect_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2627,7 +1588,7 @@ public function updateRequest($url_redirect_id, $url_mapping, string $contentTyp if (isset($url_mapping)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($url_mapping), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $url_mapping; } @@ -2648,7 +1609,7 @@ public function updateRequest($url_redirect_id, $url_mapping, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/UrlRedirects/Api/RedirectsApi.php b/codegen/Cms/UrlRedirects/Api/RedirectsApi.php deleted file mode 100644 index b066f522..00000000 --- a/codegen/Cms/UrlRedirects/Api/RedirectsApi.php +++ /dev/null @@ -1,1731 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getPage' => [ - '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 redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($url_redirect_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($url_redirect_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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\UrlRedirects\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($url_redirect_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($url_redirect_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\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($url_redirect_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($url_redirect_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 $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'url_redirect_id' is set - if ($url_redirect_id === null || (is_array($url_redirect_id) && count($url_redirect_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_redirect_id when calling archive' - ); - } - - - $resourcePath = '/cms/v3/url-redirects/{urlRedirectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($url_redirect_id !== null) { - $resourcePath = str_replace( - '{' . 'urlRedirectId' . '}', - ObjectSerializer::toPathValue($url_redirect_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 a redirect - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMappingCreateRequestBody $url_mapping_create_request_body url_mapping_create_request_body (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\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function create($url_mapping_create_request_body, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($url_mapping_create_request_body, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a redirect - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMappingCreateRequestBody $url_mapping_create_request_body (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\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($url_mapping_create_request_body, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($url_mapping_create_request_body, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a redirect - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMappingCreateRequestBody $url_mapping_create_request_body (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($url_mapping_create_request_body, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($url_mapping_create_request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a redirect - * - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMappingCreateRequestBody $url_mapping_create_request_body (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($url_mapping_create_request_body, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; - $request = $this->createRequest($url_mapping_create_request_body, $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\UrlRedirects\Model\UrlMappingCreateRequestBody $url_mapping_create_request_body (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($url_mapping_create_request_body, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'url_mapping_create_request_body' is set - if ($url_mapping_create_request_body === null || (is_array($url_mapping_create_request_body) && count($url_mapping_create_request_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_mapping_create_request_body when calling create' - ); - } - - - $resourcePath = '/cms/v3/url-redirects/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($url_mapping_create_request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($url_mapping_create_request_body)); - } else { - $httpBody = $url_mapping_create_request_body; - } - } 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 - * - * Get details for a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function getById($url_redirect_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($url_redirect_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get details for a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($url_redirect_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($url_redirect_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get details for a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($url_redirect_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get details for a redirect - * - * @param string $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; - $request = $this->getByIdRequest($url_redirect_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 string $url_redirect_id The ID of the target redirect. (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($url_redirect_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'url_redirect_id' is set - if ($url_redirect_id === null || (is_array($url_redirect_id) && count($url_redirect_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_redirect_id when calling getById' - ); - } - - - $resourcePath = '/cms/v3/url-redirects/{urlRedirectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($url_redirect_id !== null) { - $resourcePath = str_replace( - '{' . 'urlRedirectId' . '}', - ObjectSerializer::toPathValue($url_redirect_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 current redirects - * - * @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 A query parameter to specify the order in which the URL redirects are returned. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging|\HubSpot\Client\Cms\UrlRedirects\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, 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, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get current redirects - * - * @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 A query parameter to specify the order in which the URL redirects are returned. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging|\HubSpot\Client\Cms\UrlRedirects\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, 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, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get current redirects - * - * @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 A query parameter to specify the order in which the URL redirects are returned. (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 - * @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, 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, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get current redirects - * - * @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 A query parameter to specify the order in which the URL redirects are returned. (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 - * @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, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging'; - $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $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 'getPage' - * - * @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 A query parameter to specify the order in which the URL redirects are returned. (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 - * @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, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - - - - - - - $resourcePath = '/cms/v3/url-redirects/'; - $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 - ) ?? []); - - - - - $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 update - * - * Update a redirect - * - * @param string $url_redirect_id The ID of the target url redirect to update. (required) - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping url_mapping (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\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error - */ - public function update($url_redirect_id, $url_mapping, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($url_redirect_id, $url_mapping, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a redirect - * - * @param string $url_redirect_id The ID of the target url redirect to update. (required) - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (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\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping|\HubSpot\Client\Cms\UrlRedirects\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($url_redirect_id, $url_mapping, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($url_redirect_id, $url_mapping, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\UrlRedirects\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a redirect - * - * @param string $url_redirect_id The ID of the target url redirect to update. (required) - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (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($url_redirect_id, $url_mapping, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($url_redirect_id, $url_mapping, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a redirect - * - * @param string $url_redirect_id The ID of the target url redirect to update. (required) - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (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($url_redirect_id, $url_mapping, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; - $request = $this->updateRequest($url_redirect_id, $url_mapping, $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 string $url_redirect_id The ID of the target url redirect to update. (required) - * @param \HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping $url_mapping (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($url_redirect_id, $url_mapping, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'url_redirect_id' is set - if ($url_redirect_id === null || (is_array($url_redirect_id) && count($url_redirect_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_redirect_id when calling update' - ); - } - - // verify the required parameter 'url_mapping' is set - if ($url_mapping === null || (is_array($url_mapping) && count($url_mapping) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $url_mapping when calling update' - ); - } - - - $resourcePath = '/cms/v3/url-redirects/{urlRedirectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($url_redirect_id !== null) { - $resourcePath = str_replace( - '{' . 'urlRedirectId' . '}', - ObjectSerializer::toPathValue($url_redirect_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($url_mapping)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($url_mapping)); - } else { - $httpBody = $url_mapping; - } - } 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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/CommunicationPreferences/Api/AdvancedApi.php b/codegen/CommunicationPreferences/Api/AdvancedApi.php index b3c65eb4..cd52929b 100644 --- a/codegen/CommunicationPreferences/Api/AdvancedApi.php +++ b/codegen/CommunicationPreferences/Api/AdvancedApi.php @@ -350,7 +350,7 @@ public function subscribeRequest($public_update_subscription_status_request, str if (isset($public_update_subscription_status_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_update_subscription_status_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_update_subscription_status_request; } @@ -371,7 +371,7 @@ public function subscribeRequest($public_update_subscription_status_request, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -627,7 +627,7 @@ public function unsubscribeRequest($public_update_subscription_status_request, s if (isset($public_update_subscription_status_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_update_subscription_status_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_update_subscription_status_request; } @@ -648,7 +648,7 @@ public function unsubscribeRequest($public_update_subscription_status_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/CommunicationPreferences/Api/BasicApi.php b/codegen/CommunicationPreferences/Api/BasicApi.php index 8d2983d9..45586c5b 100644 --- a/codegen/CommunicationPreferences/Api/BasicApi.php +++ b/codegen/CommunicationPreferences/Api/BasicApi.php @@ -372,7 +372,7 @@ public function getEmailStatusRequest($email_address, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function getPageRequest(string $contentType = self::contentTypes['getPage } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/CommunicationPreferences/Api/DefinitionsApi.php b/codegen/CommunicationPreferences/Api/DefinitionsApi.php deleted file mode 100644 index 412f1c13..00000000 --- a/codegen/CommunicationPreferences/Api/DefinitionsApi.php +++ /dev/null @@ -1,463 +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, - 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 getPage - * - * Get subscription definitions - * - * @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\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse|\HubSpot\Client\CommunicationPreferences\Model\Error - */ - public function getPage(string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get subscription definitions - * - * @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\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse|\HubSpot\Client\CommunicationPreferences\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo(string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get subscription definitions - * - * @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(string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get subscription definitions - * - * @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(string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse'; - $request = $this->getPageRequest($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 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(string $contentType = self::contentTypes['getPage'][0]) - { - - - $resourcePath = '/communication-preferences/v3/definitions'; - $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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/CommunicationPreferences/Api/StatusApi.php b/codegen/CommunicationPreferences/Api/StatusApi.php deleted file mode 100644 index cd67ca6c..00000000 --- a/codegen/CommunicationPreferences/Api/StatusApi.php +++ /dev/null @@ -1,1059 +0,0 @@ - [ - 'application/json', - ], - 'subscribe' => [ - 'application/json', - ], - 'unsubscribe' => [ - '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 getEmailStatus - * - * Get subscription statuses for a contact - * - * @param string $email_address email_address (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailStatus'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse|\HubSpot\Client\CommunicationPreferences\Model\Error - */ - public function getEmailStatus($email_address, string $contentType = self::contentTypes['getEmailStatus'][0]) - { - list($response) = $this->getEmailStatusWithHttpInfo($email_address, $contentType); - return $response; - } - - /** - * Operation getEmailStatusWithHttpInfo - * - * Get subscription statuses for a contact - * - * @param string $email_address (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailStatus'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse|\HubSpot\Client\CommunicationPreferences\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getEmailStatusWithHttpInfo($email_address, string $contentType = self::contentTypes['getEmailStatus'][0]) - { - $request = $this->getEmailStatusRequest($email_address, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getEmailStatusAsync - * - * Get subscription statuses for a contact - * - * @param string $email_address (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getEmailStatusAsync($email_address, string $contentType = self::contentTypes['getEmailStatus'][0]) - { - return $this->getEmailStatusAsyncWithHttpInfo($email_address, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getEmailStatusAsyncWithHttpInfo - * - * Get subscription statuses for a contact - * - * @param string $email_address (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getEmailStatusAsyncWithHttpInfo($email_address, string $contentType = self::contentTypes['getEmailStatus'][0]) - { - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse'; - $request = $this->getEmailStatusRequest($email_address, $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 'getEmailStatus' - * - * @param string $email_address (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getEmailStatusRequest($email_address, string $contentType = self::contentTypes['getEmailStatus'][0]) - { - - // verify the required parameter 'email_address' is set - if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $email_address when calling getEmailStatus' - ); - } - - - $resourcePath = '/communication-preferences/v3/status/email/{emailAddress}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($email_address !== null) { - $resourcePath = str_replace( - '{' . 'emailAddress' . '}', - ObjectSerializer::toPathValue($email_address), - $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 subscribe - * - * Subscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribe'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus|\HubSpot\Client\CommunicationPreferences\Model\Error - */ - public function subscribe($public_update_subscription_status_request, string $contentType = self::contentTypes['subscribe'][0]) - { - list($response) = $this->subscribeWithHttpInfo($public_update_subscription_status_request, $contentType); - return $response; - } - - /** - * Operation subscribeWithHttpInfo - * - * Subscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribe'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus|\HubSpot\Client\CommunicationPreferences\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function subscribeWithHttpInfo($public_update_subscription_status_request, string $contentType = self::contentTypes['subscribe'][0]) - { - $request = $this->subscribeRequest($public_update_subscription_status_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation subscribeAsync - * - * Subscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function subscribeAsync($public_update_subscription_status_request, string $contentType = self::contentTypes['subscribe'][0]) - { - return $this->subscribeAsyncWithHttpInfo($public_update_subscription_status_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation subscribeAsyncWithHttpInfo - * - * Subscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function subscribeAsyncWithHttpInfo($public_update_subscription_status_request, string $contentType = self::contentTypes['subscribe'][0]) - { - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; - $request = $this->subscribeRequest($public_update_subscription_status_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 'subscribe' - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['subscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function subscribeRequest($public_update_subscription_status_request, string $contentType = self::contentTypes['subscribe'][0]) - { - - // verify the required parameter 'public_update_subscription_status_request' is set - if ($public_update_subscription_status_request === null || (is_array($public_update_subscription_status_request) && count($public_update_subscription_status_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_update_subscription_status_request when calling subscribe' - ); - } - - - $resourcePath = '/communication-preferences/v3/subscribe'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_update_subscription_status_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_update_subscription_status_request)); - } else { - $httpBody = $public_update_subscription_status_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 unsubscribe - * - * Unsubscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unsubscribe'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus|\HubSpot\Client\CommunicationPreferences\Model\Error - */ - public function unsubscribe($public_update_subscription_status_request, string $contentType = self::contentTypes['unsubscribe'][0]) - { - list($response) = $this->unsubscribeWithHttpInfo($public_update_subscription_status_request, $contentType); - return $response; - } - - /** - * Operation unsubscribeWithHttpInfo - * - * Unsubscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unsubscribe'] to see the possible values for this operation - * - * @throws \HubSpot\Client\CommunicationPreferences\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus|\HubSpot\Client\CommunicationPreferences\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function unsubscribeWithHttpInfo($public_update_subscription_status_request, string $contentType = self::contentTypes['unsubscribe'][0]) - { - $request = $this->unsubscribeRequest($public_update_subscription_status_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\CommunicationPreferences\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation unsubscribeAsync - * - * Unsubscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unsubscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function unsubscribeAsync($public_update_subscription_status_request, string $contentType = self::contentTypes['unsubscribe'][0]) - { - return $this->unsubscribeAsyncWithHttpInfo($public_update_subscription_status_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation unsubscribeAsyncWithHttpInfo - * - * Unsubscribe a contact - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unsubscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function unsubscribeAsyncWithHttpInfo($public_update_subscription_status_request, string $contentType = self::contentTypes['unsubscribe'][0]) - { - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; - $request = $this->unsubscribeRequest($public_update_subscription_status_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 'unsubscribe' - * - * @param \HubSpot\Client\CommunicationPreferences\Model\PublicUpdateSubscriptionStatusRequest $public_update_subscription_status_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unsubscribe'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function unsubscribeRequest($public_update_subscription_status_request, string $contentType = self::contentTypes['unsubscribe'][0]) - { - - // verify the required parameter 'public_update_subscription_status_request' is set - if ($public_update_subscription_status_request === null || (is_array($public_update_subscription_status_request) && count($public_update_subscription_status_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_update_subscription_status_request when calling unsubscribe' - ); - } - - - $resourcePath = '/communication-preferences/v3/unsubscribe'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_update_subscription_status_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_update_subscription_status_request)); - } else { - $httpBody = $public_update_subscription_status_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Conversations/VisitorIdentification/Api/BasicApi.php b/codegen/Conversations/VisitorIdentification/Api/BasicApi.php index 5b1e9f4a..e14c7491 100644 --- a/codegen/Conversations/VisitorIdentification/Api/BasicApi.php +++ b/codegen/Conversations/VisitorIdentification/Api/BasicApi.php @@ -355,7 +355,7 @@ public function generateTokenRequest($identification_token_generation_request, s if (isset($identification_token_generation_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($identification_token_generation_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $identification_token_generation_request; } @@ -376,7 +376,7 @@ public function generateTokenRequest($identification_token_generation_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php b/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php deleted file mode 100644 index b37242d9..00000000 --- a/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php +++ /dev/null @@ -1,482 +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, - 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 generateToken - * - * Generate an identification token for a verified website visitor. - * - * @param \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenGenerationRequest $identification_token_generation_request identification_token_generation_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateToken'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Conversations\VisitorIdentification\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse|\HubSpot\Client\Conversations\VisitorIdentification\Model\Error - */ - public function generateToken($identification_token_generation_request, string $contentType = self::contentTypes['generateToken'][0]) - { - list($response) = $this->generateTokenWithHttpInfo($identification_token_generation_request, $contentType); - return $response; - } - - /** - * Operation generateTokenWithHttpInfo - * - * Generate an identification token for a verified website visitor. - * - * @param \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenGenerationRequest $identification_token_generation_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateToken'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Conversations\VisitorIdentification\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse|\HubSpot\Client\Conversations\VisitorIdentification\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function generateTokenWithHttpInfo($identification_token_generation_request, string $contentType = self::contentTypes['generateToken'][0]) - { - $request = $this->generateTokenRequest($identification_token_generation_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Conversations\VisitorIdentification\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Conversations\VisitorIdentification\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation generateTokenAsync - * - * Generate an identification token for a verified website visitor. - * - * @param \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenGenerationRequest $identification_token_generation_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateToken'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function generateTokenAsync($identification_token_generation_request, string $contentType = self::contentTypes['generateToken'][0]) - { - return $this->generateTokenAsyncWithHttpInfo($identification_token_generation_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation generateTokenAsyncWithHttpInfo - * - * Generate an identification token for a verified website visitor. - * - * @param \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenGenerationRequest $identification_token_generation_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateToken'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function generateTokenAsyncWithHttpInfo($identification_token_generation_request, string $contentType = self::contentTypes['generateToken'][0]) - { - $returnType = '\HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse'; - $request = $this->generateTokenRequest($identification_token_generation_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 'generateToken' - * - * @param \HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenGenerationRequest $identification_token_generation_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateToken'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function generateTokenRequest($identification_token_generation_request, string $contentType = self::contentTypes['generateToken'][0]) - { - - // verify the required parameter 'identification_token_generation_request' is set - if ($identification_token_generation_request === null || (is_array($identification_token_generation_request) && count($identification_token_generation_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $identification_token_generation_request when calling generateToken' - ); - } - - - $resourcePath = '/visitor-identification/v3/tokens/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($identification_token_generation_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($identification_token_generation_request)); - } else { - $httpBody = $identification_token_generation_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Associations/Api/BatchApi.php b/codegen/Crm/Associations/Api/BatchApi.php index 0e84745f..083e584e 100644 --- a/codegen/Crm/Associations/Api/BatchApi.php +++ b/codegen/Crm/Associations/Api/BatchApi.php @@ -345,7 +345,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_association)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association; } @@ -366,7 +366,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -684,7 +684,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p if (isset($batch_input_public_association)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association; } @@ -705,7 +705,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1023,7 +1023,7 @@ public function readRequest($from_object_type, $to_object_type, $batch_input_pub if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -1044,7 +1044,7 @@ public function readRequest($from_object_type, $to_object_type, $batch_input_pub } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/Schema/Api/BasicApi.php b/codegen/Crm/Associations/Schema/Api/BasicApi.php index 3ce0fca2..7b17e573 100644 --- a/codegen/Crm/Associations/Schema/Api/BasicApi.php +++ b/codegen/Crm/Associations/Schema/Api/BasicApi.php @@ -389,7 +389,7 @@ public function getAllRequest($from_object_type, $to_object_type, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/Schema/Api/TypesApi.php b/codegen/Crm/Associations/Schema/Api/TypesApi.php deleted file mode 100644 index cb53ea57..00000000 --- a/codegen/Crm/Associations/Schema/Api/TypesApi.php +++ /dev/null @@ -1,503 +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, - 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 getAll - * - * Retrieve association types between objects. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @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\Schema\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging|\HubSpot\Client\Crm\Associations\Schema\Model\Error - */ - public function getAll($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($from_object_type, $to_object_type, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Retrieve association types between objects. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @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\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\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging|\HubSpot\Client\Crm\Associations\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Retrieve association types between objects. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @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($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Retrieve association types between objects. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @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($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging'; - $request = $this->getAllRequest($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 'getAll' - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @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($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 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 getAll' - ); - } - - - $resourcePath = '/crm/v3/associations/{fromObjectType}/{toObjectType}/types'; - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Associations/V4/Api/BasicApi.php b/codegen/Crm/Associations/V4/Api/BasicApi.php index ed0ba58f..6b0d1b4f 100644 --- a/codegen/Crm/Associations/V4/Api/BasicApi.php +++ b/codegen/Crm/Associations/V4/Api/BasicApi.php @@ -390,7 +390,7 @@ public function archiveRequest($object_type, $object_id, $to_object_type, $to_ob } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -734,7 +734,7 @@ public function createRequest($object_type, $object_id, $to_object_type, $to_obj if (isset($association_spec)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($association_spec), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $association_spec; } @@ -755,7 +755,7 @@ public function createRequest($object_type, $object_id, $to_object_type, $to_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1101,7 +1101,7 @@ public function createDefaultRequest($from_object_type, $from_object_id, $to_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1457,7 +1457,7 @@ public function getPageRequest($object_type, $object_id, $to_object_type, $after } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Api/BatchApi.php b/codegen/Crm/Associations/V4/Api/BatchApi.php index af8b1acf..06143882 100644 --- a/codegen/Crm/Associations/V4/Api/BatchApi.php +++ b/codegen/Crm/Associations/V4/Api/BatchApi.php @@ -351,7 +351,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_association_multi_archive)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_archive), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_archive; } @@ -372,7 +372,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -620,7 +620,7 @@ public function archiveLabelsRequest($from_object_type, $to_object_type, $batch_ if (isset($batch_input_public_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_post; } @@ -641,7 +641,7 @@ public function archiveLabelsRequest($from_object_type, $to_object_type, $batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -959,7 +959,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p if (isset($batch_input_public_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_post; } @@ -980,7 +980,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1284,7 +1284,7 @@ public function createDefaultRequest($from_object_type, $to_object_type, $batch_ if (isset($batch_input_public_default_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_default_association_multi_post), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_default_association_multi_post; } @@ -1305,7 +1305,7 @@ public function createDefaultRequest($from_object_type, $to_object_type, $batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1623,7 +1623,7 @@ public function getPageRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_fetch_associations_batch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_fetch_associations_batch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_fetch_associations_batch_request; } @@ -1644,7 +1644,7 @@ public function getPageRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Api/ReportApi.php b/codegen/Crm/Associations/V4/Api/ReportApi.php index 0eada690..5873160b 100644 --- a/codegen/Crm/Associations/V4/Api/ReportApi.php +++ b/codegen/Crm/Associations/V4/Api/ReportApi.php @@ -377,7 +377,7 @@ public function requestRequest($user_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php index 2224a6a1..561dd85e 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php @@ -419,7 +419,7 @@ public function getErrors() /** * Sets errors * - * @param \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null $errors errors + * @param \HubSpot\Client\Crm\Associations\V4\Model\StandardError[]|null $errors An array of StandardError objects detailing any errors that occurred during the batch operation. * * @return self */ @@ -527,7 +527,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociation1[] $results results + * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicDefaultAssociation1[] $results An array of PublicDefaultAssociation objects representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php index 29532d1d..8ca2cc9f 100644 --- a/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php +++ b/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php @@ -316,7 +316,7 @@ public function getAssociationTypes() /** * Sets association_types * - * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] $association_types association_types + * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpecWithLabel[] $association_types An array of association types that define the relationships between this object and other objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php deleted file mode 100644 index f2f91f0b..00000000 --- a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php +++ /dev/null @@ -1,486 +0,0 @@ - - */ -class PublicDefaultAssociation implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicDefaultAssociation'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'association_spec' => '\HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec', - 'from' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId', - 'to' => '\HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'association_spec' => null, - 'from' => null, - 'to' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'association_spec' => false, - 'from' => 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 = [ - 'association_spec' => 'associationSpec', - 'from' => 'from', - 'to' => 'to' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'association_spec' => 'setAssociationSpec', - 'from' => 'setFrom', - 'to' => 'setTo' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'association_spec' => 'getAssociationSpec', - 'from' => 'getFrom', - '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('association_spec', $data ?? [], null); - $this->setIfExists('from', $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['association_spec'] === null) { - $invalidProperties[] = "'association_spec' can't be null"; - } - if ($this->container['from'] === null) { - $invalidProperties[] = "'from' 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 association_spec - * - * @return \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec - */ - public function getAssociationSpec() - { - return $this->container['association_spec']; - } - - /** - * Sets association_spec - * - * @param \HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec $association_spec association_spec - * - * @return self - */ - public function setAssociationSpec($association_spec) - { - if (is_null($association_spec)) { - throw new \InvalidArgumentException('non-nullable association_spec cannot be null'); - } - $this->container['association_spec'] = $association_spec; - - return $this; - } - - /** - * Gets from - * - * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId - */ - public function getFrom() - { - return $this->container['from']; - } - - /** - * Sets from - * - * @param \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId $from from - * - * @return self - */ - public function setFrom($from) - { - if (is_null($from)) { - throw new \InvalidArgumentException('non-nullable from cannot be null'); - } - $this->container['from'] = $from; - - return $this; - } - - /** - * Gets to - * - * @return \HubSpot\Client\Crm\Associations\V4\Model\PublicObjectId - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param \HubSpot\Client\Crm\Associations\V4\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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Api/DefinitionConfigurationsApi.php b/codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php deleted file mode 100644 index 588a0e13..00000000 --- a/codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php +++ /dev/null @@ -1,1756 +0,0 @@ - [ - 'application/json', - ], - 'batchRemove' => [ - 'application/json', - ], - 'batchUpdate' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'getPageBetweenTwoObjectTypes' => [ - '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 - * - * Batch create association definitions between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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 - * - * Batch create association definitions between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation batchCreateAsync - * - * Batch create association definitions between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * Batch create association definitions between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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/associations/v4/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 - * - * Remove multiple association configurations between two specified object types in a batch operation. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error - */ - public function batchRemove($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) - { - list($response) = $this->batchRemoveWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_spec, $contentType); - return $response; - } - - /** - * Operation batchRemoveWithHttpInfo - * - * Remove multiple association configurations between two specified object types in a batch operation. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, 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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation batchRemoveAsync - * - * Remove multiple association configurations between two specified object types in a batch operation. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * Remove multiple association configurations between two specified object types in a batch operation. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponseVoid'; - $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) { - 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 'batchRemove' - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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/associations/v4/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( - ['application/json', '*/*', ], - $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 - * - * Batch update association configurations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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 - * - * Batch update association configurations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult', - $request, - $response, - ); - } 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); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation batchUpdateAsync - * - * Batch update association configurations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * Batch update association configurations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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/associations/v4/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 getPage - * - * Retrieve all association configuration definitions. - * - * @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\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\CollectionResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error - */ - public function getPage(string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Retrieve all association configuration definitions. - * - * @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\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\CollectionResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo(string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Retrieve all association configuration definitions. - * - * @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(string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Retrieve all association configuration definitions. - * - * @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(string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration'; - $request = $this->getPageRequest($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 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(string $contentType = self::contentTypes['getPage'][0]) - { - - - $resourcePath = '/crm/associations/v4/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 getPageBetweenTwoObjectTypes - * - * Retrieve configuration details for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageBetweenTwoObjectTypes'] 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\CollectionResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error - */ - public function getPageBetweenTwoObjectTypes($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPageBetweenTwoObjectTypes'][0]) - { - list($response) = $this->getPageBetweenTwoObjectTypesWithHttpInfo($from_object_type, $to_object_type, $contentType); - return $response; - } - - /** - * Operation getPageBetweenTwoObjectTypesWithHttpInfo - * - * Retrieve configuration details for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageBetweenTwoObjectTypes'] 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\CollectionResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageBetweenTwoObjectTypesWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPageBetweenTwoObjectTypes'][0]) - { - $request = $this->getPageBetweenTwoObjectTypesRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageBetweenTwoObjectTypesAsync - * - * Retrieve configuration details for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageBetweenTwoObjectTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageBetweenTwoObjectTypesAsync($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPageBetweenTwoObjectTypes'][0]) - { - return $this->getPageBetweenTwoObjectTypesAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageBetweenTwoObjectTypesAsyncWithHttpInfo - * - * Retrieve configuration details for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageBetweenTwoObjectTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageBetweenTwoObjectTypesAsyncWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPageBetweenTwoObjectTypes'][0]) - { - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfiguration'; - $request = $this->getPageBetweenTwoObjectTypesRequest($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 'getPageBetweenTwoObjectTypes' - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageBetweenTwoObjectTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageBetweenTwoObjectTypesRequest($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPageBetweenTwoObjectTypes'][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 getPageBetweenTwoObjectTypes' - ); - } - - // 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 getPageBetweenTwoObjectTypes' - ); - } - - - $resourcePath = '/crm/associations/v4/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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php b/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php deleted file mode 100644 index 90447074..00000000 --- a/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php +++ /dev/null @@ -1,1376 +0,0 @@ - [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'remove' => [ - '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 create - * - * Create a new label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * @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\CollectionResponseAssociationSpecWithLabel|\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]) - { - list($response) = $this->createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a new label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * @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\CollectionResponseAssociationSpecWithLabel|\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]) - { - $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_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 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a new label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * @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]) - { - return $this->createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a new label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * @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]) - { - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel'; - $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) { - 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 string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * - * @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]) - { - - // 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' - ); - } - - // 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' - ); - } - - - $resourcePath = '/crm/associations/v4/{fromObjectType}/{toObjectType}/labels'; - $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($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) { - $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 getPage - * - * Retrieve labels for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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\CollectionResponseAssociationSpecWithLabel|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error - */ - public function getPage($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($from_object_type, $to_object_type, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Retrieve labels for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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\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\CollectionResponseAssociationSpecWithLabel|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Retrieve labels for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Retrieve labels for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabel'; - $request = $this->getPageRequest($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 'getPage' - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($from_object_type, $to_object_type, string $contentType = self::contentTypes['getPage'][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 getPage' - ); - } - - // 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 getPage' - ); - } - - - $resourcePath = '/crm/associations/v4/{fromObjectType}/{toObjectType}/labels'; - $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 - ); - } - - /** - * Operation remove - * - * Delete a label for an association between two object types. - * - * @param int $association_type_id The unique identifier for the association type. (required) - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 void - */ - public function remove($association_type_id, $from_object_type, $to_object_type, string $contentType = self::contentTypes['remove'][0]) - { - $this->removeWithHttpInfo($association_type_id, $from_object_type, $to_object_type, $contentType); - } - - /** - * Operation removeWithHttpInfo - * - * Delete a label for an association between two object types. - * - * @param int $association_type_id The unique identifier for the association type. (required) - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeWithHttpInfo($association_type_id, $from_object_type, $to_object_type, string $contentType = self::contentTypes['remove'][0]) - { - $request = $this->removeRequest($association_type_id, $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(); - - - 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); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAsync - * - * Delete a label for an association between two object types. - * - * @param int $association_type_id The unique identifier for the association type. (required) - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 removeAsync($association_type_id, $from_object_type, $to_object_type, string $contentType = self::contentTypes['remove'][0]) - { - return $this->removeAsyncWithHttpInfo($association_type_id, $from_object_type, $to_object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAsyncWithHttpInfo - * - * Delete a label for an association between two object types. - * - * @param int $association_type_id The unique identifier for the association type. (required) - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 removeAsyncWithHttpInfo($association_type_id, $from_object_type, $to_object_type, string $contentType = self::contentTypes['remove'][0]) - { - $returnType = ''; - $request = $this->removeRequest($association_type_id, $from_object_type, $to_object_type, $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 'remove' - * - * @param int $association_type_id The unique identifier for the association type. (required) - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (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 removeRequest($association_type_id, $from_object_type, $to_object_type, string $contentType = self::contentTypes['remove'][0]) - { - - // 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' - ); - } - - // 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 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 remove' - ); - } - - - $resourcePath = '/crm/associations/v4/{fromObjectType}/{toObjectType}/labels/{associationTypeId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($association_type_id !== null) { - $resourcePath = str_replace( - '{' . 'associationTypeId' . '}', - ObjectSerializer::toPathValue($association_type_id), - $resourcePath - ); - } - // 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 (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 update - * - * Update an existing label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_request public_association_definition_update_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\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 update($from_object_type, $to_object_type, $public_association_definition_update_request, string $contentType = self::contentTypes['update'][0]) - { - $this->updateWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request, $contentType); - } - - /** - * Operation updateWithHttpInfo - * - * Update an existing label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_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\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 updateWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($from_object_type, $to_object_type, $public_association_definition_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(); - - - 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); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update an existing label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_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($from_object_type, $to_object_type, $public_association_definition_update_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update an existing label for associations between two object types. - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_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($from_object_type, $to_object_type, $public_association_definition_update_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = ''; - $request = $this->updateRequest($from_object_type, $to_object_type, $public_association_definition_update_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 'update' - * - * @param string $from_object_type The type of the source object in the association. (required) - * @param string $to_object_type The type of the target object in the association. (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUpdateRequest $public_association_definition_update_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($from_object_type, $to_object_type, $public_association_definition_update_request, string $contentType = self::contentTypes['update'][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 update' - ); - } - - // 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 update' - ); - } - - // verify the required parameter 'public_association_definition_update_request' is set - if ($public_association_definition_update_request === null || (is_array($public_association_definition_update_request) && count($public_association_definition_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_association_definition_update_request when calling update' - ); - } - - - $resourcePath = '/crm/associations/v4/{fromObjectType}/{toObjectType}/labels'; - $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($public_association_definition_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($public_association_definition_update_request)); - } else { - $httpBody = $public_association_definition_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( - 'PUT', - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php b/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php index 495bca22..2f600941 100644 --- a/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php +++ b/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php @@ -404,7 +404,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_association_definition_create_request; } @@ -425,7 +425,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -731,7 +731,7 @@ public function getPageRequest($from_object_type, $to_object_type, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1001,7 +1001,7 @@ public function removeRequest($association_type_id, $from_object_type, $to_objec } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1249,7 +1249,7 @@ public function updateRequest($from_object_type, $to_object_type, $public_associ if (isset($public_association_definition_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_association_definition_update_request; } @@ -1270,7 +1270,7 @@ public function updateRequest($from_object_type, $to_object_type, $public_associ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php b/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php index 436b4278..ddac8a9b 100644 --- a/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php +++ b/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php @@ -421,7 +421,7 @@ public function batchCreateRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_definition_configuration_create_request; } @@ -442,7 +442,7 @@ public function batchCreateRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -690,7 +690,7 @@ public function batchRemoveRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_spec), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_spec; } @@ -711,7 +711,7 @@ public function batchRemoveRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1029,7 +1029,7 @@ public function batchUpdateRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_definition_configuration_update_request; } @@ -1050,7 +1050,7 @@ public function batchUpdateRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1316,7 +1316,7 @@ public function getPageRequest(string $contentType = self::contentTypes['getPage } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1622,7 +1622,7 @@ public function getPageBetweenTwoObjectTypesRequest($from_object_type, $to_objec } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchResponseVoid.php b/codegen/Crm/Associations/V4/Schema/Model/BatchResponseVoid.php deleted file mode 100644 index 5360f42d..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/BatchResponseVoid.php +++ /dev/null @@ -1,697 +0,0 @@ - - */ -class BatchResponseVoid implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'BatchResponseVoid'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'completed_at' => '\DateTime', - 'errors' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]', - 'links' => 'array', - 'num_errors' => 'int', - 'requested_at' => '\DateTime', - 'results' => 'mixed[]', - 'started_at' => '\DateTime', - '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', - 'errors' => null, - 'links' => null, - 'num_errors' => 'int32', - 'requested_at' => 'date-time', - 'results' => null, - 'started_at' => 'date-time', - 'status' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'completed_at' => false, - 'errors' => false, - 'links' => false, - 'num_errors' => false, - 'requested_at' => false, - 'results' => false, - 'started_at' => 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', - 'errors' => 'errors', - 'links' => 'links', - 'num_errors' => 'numErrors', - 'requested_at' => 'requestedAt', - 'results' => 'results', - 'started_at' => 'startedAt', - 'status' => 'status' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'completed_at' => 'setCompletedAt', - 'errors' => 'setErrors', - 'links' => 'setLinks', - 'num_errors' => 'setNumErrors', - 'requested_at' => 'setRequestedAt', - 'results' => 'setResults', - 'started_at' => 'setStartedAt', - 'status' => 'setStatus' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'completed_at' => 'getCompletedAt', - 'errors' => 'getErrors', - 'links' => 'getLinks', - 'num_errors' => 'getNumErrors', - 'requested_at' => 'getRequestedAt', - 'results' => 'getResults', - 'started_at' => 'getStartedAt', - '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_CANCELED = 'CANCELED'; - public const STATUS_COMPLETE = 'COMPLETE'; - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_CANCELED, - self::STATUS_COMPLETE, - self::STATUS_PENDING, - self::STATUS_PROCESSING, - ]; - } - - /** - * 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('errors', $data ?? [], null); - $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('num_errors', $data ?? [], null); - $this->setIfExists('requested_at', $data ?? [], null); - $this->setIfExists('results', $data ?? [], null); - $this->setIfExists('started_at', $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['results'] === null) { - $invalidProperties[] = "'results' can't be null"; - } - if ($this->container['started_at'] === null) { - $invalidProperties[] = "'started_at' 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 The date and time when the batch operation was completed. - * - * @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 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 links - * - * @return array|null - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param array|null $links A collection of URLs linking to related resources or documentation. - * - * @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 num_errors - * - * @return int|null - */ - public function getNumErrors() - { - return $this->container['num_errors']; - } - - /** - * Sets num_errors - * - * @param int|null $num_errors The total number of errors that occurred during the batch operation. - * - * @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 The date and time when the batch request was made. - * - * @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 results - * - * @return mixed[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param mixed[] $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 started_at - * - * @return \DateTime - */ - public function getStartedAt() - { - return $this->container['started_at']; - } - - /** - * Sets started_at - * - * @param \DateTime $started_at The date and time when the batch operation began. - * - * @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 status - * - * @return string - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string $status The current status of the batch operation, which can be CANCELED, COMPLETE, PENDING, or PROCESSING. - * - * @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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseAssociationSpecWithLabel.php b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabel.php deleted file mode 100644 index 1fd1b629..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabel.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseAssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseAssociationSpecWithLabel'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\AssociationSpecWithLabel[]' - ]; - - /** - * 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\Crm\Associations\V4\Schema\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\Paging|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\Crm\Associations\V4\Schema\Model\AssociationSpecWithLabel[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\AssociationSpecWithLabel[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponsePublicAssociationDefinitionUserConfiguration.php b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfiguration.php deleted file mode 100644 index 246487f2..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfiguration.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponsePublicAssociationDefinitionUserConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponsePublicAssociationDefinitionUserConfiguration'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Paging', - '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 = [ - '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\Crm\Associations\V4\Schema\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\Paging|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\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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/NextPage.php b/codegen/Crm/Associations/V4/Schema/Model/NextPage.php deleted file mode 100644 index 2d94f970..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/NextPage.php +++ /dev/null @@ -1,447 +0,0 @@ - - */ -class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'NextPage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'after' => 'string', - 'link' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'after' => null, - 'link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'after' => false, - 'link' => 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 = [ - 'after' => 'after', - 'link' => 'link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'after' => 'setAfter', - 'link' => 'setLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'after' => 'getAfter', - 'link' => 'getLink' - ]; - - /** - * 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('after', $data ?? [], null); - $this->setIfExists('link', $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['after'] === null) { - $invalidProperties[] = "'after' 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 after - * - * @return string - */ - public function getAfter() - { - return $this->container['after']; - } - - /** - * Sets after - * - * @param string $after A paging cursor token for retrieving subsequent pages. - * - * @return self - */ - public function setAfter($after) - { - if (is_null($after)) { - throw new \InvalidArgumentException('non-nullable after cannot be null'); - } - $this->container['after'] = $after; - - return $this; - } - - /** - * Gets link - * - * @return string|null - */ - public function getLink() - { - return $this->container['link']; - } - - /** - * Sets link - * - * @param string|null $link A URL that can be used to retrieve the next page results. - * - * @return self - */ - public function setLink($link) - { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); - } - $this->container['link'] = $link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Paging.php b/codegen/Crm/Associations/V4/Schema/Model/Paging.php deleted file mode 100644 index 7e1ba93d..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/Paging.php +++ /dev/null @@ -1,443 +0,0 @@ - - */ -class Paging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Paging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\NextPage', - 'prev' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PreviousPage' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null, - 'prev' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => false, - 'prev' => 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 = [ - 'next' => 'next', - 'prev' => 'prev' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext', - 'prev' => 'setPrev' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext', - 'prev' => 'getPrev' - ]; - - /** - * 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('next', $data ?? [], null); - $this->setIfExists('prev', $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 next - * - * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\NextPage|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\NextPage|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - - /** - * Gets prev - * - * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PreviousPage|null - */ - public function getPrev() - { - return $this->container['prev']; - } - - /** - * Sets prev - * - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PreviousPage|null $prev prev - * - * @return self - */ - public function setPrev($prev) - { - if (is_null($prev)) { - throw new \InvalidArgumentException('non-nullable prev cannot be null'); - } - $this->container['prev'] = $prev; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/PreviousPage.php b/codegen/Crm/Associations/V4/Schema/Model/PreviousPage.php deleted file mode 100644 index ae60f48f..00000000 --- a/codegen/Crm/Associations/V4/Schema/Model/PreviousPage.php +++ /dev/null @@ -1,447 +0,0 @@ - - */ -class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PreviousPage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'before' => 'string', - 'link' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'before' => null, - 'link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'before' => false, - 'link' => 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 = [ - 'before' => 'before', - 'link' => 'link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'before' => 'setBefore', - 'link' => 'setLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'before' => 'getBefore', - 'link' => 'getLink' - ]; - - /** - * 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('before', $data ?? [], null); - $this->setIfExists('link', $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['before'] === null) { - $invalidProperties[] = "'before' 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 before - * - * @return string - */ - public function getBefore() - { - return $this->container['before']; - } - - /** - * Sets before - * - * @param string $before A paging cursor token for retrieving previous pages. - * - * @return self - */ - public function setBefore($before) - { - if (is_null($before)) { - throw new \InvalidArgumentException('non-nullable before cannot be null'); - } - $this->container['before'] = $before; - - return $this; - } - - /** - * Gets link - * - * @return string|null - */ - public function getLink() - { - return $this->container['link']; - } - - /** - * Sets link - * - * @param string|null $link A URL that can be used to retrieve the previous pages' results. - * - * @return self - */ - public function setLink($link) - { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); - } - $this->container['link'] = $link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/StandardError.php b/codegen/Crm/Associations/V4/Schema/Model/StandardError.php index c4fac459..30f0ee73 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/StandardError.php +++ b/codegen/Crm/Associations/V4/Schema/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php index c9d759b4..1a9f02ea 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($invoice_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($invoice_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($invoice_id, $simple_public_object_input, $id_prop 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($invoice_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php index 0482641f..8fde48fb 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php index 1d050167..3cf0d877 100644 --- a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php index 877d18b0..a8c367e2 100644 --- a/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php +++ b/codegen/Crm/Commerce/Invoices/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php index abbae09f..317e79f4 100644 --- a/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php +++ b/codegen/Crm/Commerce/Invoices/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php index 14e486d2..cb5a5c42 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php index a889a0e4..9e05d04c 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php index 600bd2ee..a81f20b0 100644 --- a/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index a7f1c6f8..00000000 --- a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Commerce\Invoices\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\Paging|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\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObject.php index dc4f0aa2..2d939569 100644 --- a/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php index 9c264294..63df2a8b 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php index 809885ce..a4aa9406 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php index e91104e9..733510e3 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Commerce\Invoices * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php index d307d0d8..57736977 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Commerce\Invoices\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php index c2d5070a..83abc749 100644 --- a/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Commerce/Invoices/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/StandardError.php b/codegen/Crm/Commerce/Invoices/Model/StandardError.php index 12107ab3..1f70db34 100644 --- a/codegen/Crm/Commerce/Invoices/Model/StandardError.php +++ b/codegen/Crm/Commerce/Invoices/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php index bdabb6de..0850830b 100644 --- a/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Commerce/Invoices/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Companies/Api/AdvancedApi.php b/codegen/Crm/Companies/Api/AdvancedApi.php index ae05b538..86ef69e3 100644 --- a/codegen/Crm/Companies/Api/AdvancedApi.php +++ b/codegen/Crm/Companies/Api/AdvancedApi.php @@ -355,7 +355,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -376,17 +376,13 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Companies/Api/BasicApi.php b/codegen/Crm/Companies/Api/BasicApi.php index 97eed278..93e168f6 100644 --- a/codegen/Crm/Companies/Api/BasicApi.php +++ b/codegen/Crm/Companies/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($company_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($company_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($company_id, $simple_public_object_input, $id_prop 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($company_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Companies/Api/BatchApi.php b/codegen/Crm/Companies/Api/BatchApi.php index d6cdefe4..3acab104 100644 --- a/codegen/Crm/Companies/Api/BatchApi.php +++ b/codegen/Crm/Companies/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Companies/Api/SearchApi.php b/codegen/Crm/Companies/Api/SearchApi.php index f4414646..bdf232d1 100644 --- a/codegen/Crm/Companies/Api/SearchApi.php +++ b/codegen/Crm/Companies/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Companies/Model/AssociatedId.php b/codegen/Crm/Companies/Model/AssociatedId.php index 53fe08cd..b2eae286 100644 --- a/codegen/Crm/Companies/Model/AssociatedId.php +++ b/codegen/Crm/Companies/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php index 68a5dd4c..2efaed3e 100644 --- a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php index 7fad8503..828a2c24 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php index 57239c70..e0e40578 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 22fb0161..00000000 --- a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Companies\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Companies\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Companies\Model\Paging|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\Crm\Companies\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObject.php index fc90c7dd..e67d3f96 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObject.php b/codegen/Crm/Companies/Model/SimplePublicObject.php index c87885bf..138764fb 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObject.php +++ b/codegen/Crm/Companies/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php index 15c807a0..74344419 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php index 00c10158..0d106d01 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Companies * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php index 42eaddde..68399079 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php index a2f36f18..1f87c6eb 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Companies/Model/StandardError.php b/codegen/Crm/Companies/Model/StandardError.php index 900c4fd2..f878bc4d 100644 --- a/codegen/Crm/Companies/Model/StandardError.php +++ b/codegen/Crm/Companies/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Companies/Model/ValueWithTimestamp.php b/codegen/Crm/Companies/Model/ValueWithTimestamp.php index e16f6d13..543f807d 100644 --- a/codegen/Crm/Companies/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Companies/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Contacts/Api/AdvancedApi.php b/codegen/Crm/Contacts/Api/AdvancedApi.php index 8623d565..a5b9b59a 100644 --- a/codegen/Crm/Contacts/Api/AdvancedApi.php +++ b/codegen/Crm/Contacts/Api/AdvancedApi.php @@ -358,7 +358,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -379,17 +379,13 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -587,7 +583,7 @@ public function purgeRequest($public_gdpr_delete_input, string $contentType = se 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 = json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_gdpr_delete_input; } @@ -608,17 +604,13 @@ public function purgeRequest($public_gdpr_delete_input, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Contacts/Api/BasicApi.php b/codegen/Crm/Contacts/Api/BasicApi.php index 108ef6a5..42b89974 100644 --- a/codegen/Crm/Contacts/Api/BasicApi.php +++ b/codegen/Crm/Contacts/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($contact_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($contact_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($contact_id, $simple_public_object_input, $id_prop 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($contact_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Contacts/Api/BatchApi.php b/codegen/Crm/Contacts/Api/BatchApi.php index 69538d7e..041e0881 100644 --- a/codegen/Crm/Contacts/Api/BatchApi.php +++ b/codegen/Crm/Contacts/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Contacts/Api/SearchApi.php b/codegen/Crm/Contacts/Api/SearchApi.php index 9c4e8deb..8e443d54 100644 --- a/codegen/Crm/Contacts/Api/SearchApi.php +++ b/codegen/Crm/Contacts/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Contacts/Model/AssociatedId.php b/codegen/Crm/Contacts/Model/AssociatedId.php index 5e294f1d..a7605cd7 100644 --- a/codegen/Crm/Contacts/Model/AssociatedId.php +++ b/codegen/Crm/Contacts/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/AssociationSpec.php b/codegen/Crm/Contacts/Model/AssociationSpec.php index a6bbfc22..b51e40d0 100644 --- a/codegen/Crm/Contacts/Model/AssociationSpec.php +++ b/codegen/Crm/Contacts/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php index 3aa39350..9506621e 100644 --- a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php index 3fab381e..ef4ba1e2 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php index 3c56a83e..6743e684 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObject.php index 3d5d9230..eb416d62 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObject.php b/codegen/Crm/Contacts/Model/SimplePublicObject.php index e7975e3a..60a790e7 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php index e8c3a17e..4797ab01 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php index e7516ba5..5112f04c 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Contacts * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php index 00357e6b..608921fa 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php index 6b90688c..b397682c 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/StandardError.php b/codegen/Crm/Contacts/Model/StandardError.php index 0d9fed34..aafd2c90 100644 --- a/codegen/Crm/Contacts/Model/StandardError.php +++ b/codegen/Crm/Contacts/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php index aca2bee2..350b8730 100644 --- a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Deals/Api/BasicApi.php b/codegen/Crm/Deals/Api/BasicApi.php index 1039dc98..4ddc1fa6 100644 --- a/codegen/Crm/Deals/Api/BasicApi.php +++ b/codegen/Crm/Deals/Api/BasicApi.php @@ -339,17 +339,13 @@ public function archiveRequest($deal_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -603,7 +599,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,17 +620,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -988,17 +980,13 @@ public function getByIdRequest($deal_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1344,17 +1332,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1608,7 +1592,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -1629,17 +1613,13 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1931,7 +1911,7 @@ public function updateRequest($deal_id, $simple_public_object_input, $id_propert 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1952,17 +1932,13 @@ public function updateRequest($deal_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Deals/Api/BatchApi.php b/codegen/Crm/Deals/Api/BatchApi.php index c9a88051..a5bd65cd 100644 --- a/codegen/Crm/Deals/Api/BatchApi.php +++ b/codegen/Crm/Deals/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Deals/Api/SearchApi.php b/codegen/Crm/Deals/Api/SearchApi.php index 1c175bdd..bafd75b7 100644 --- a/codegen/Crm/Deals/Api/SearchApi.php +++ b/codegen/Crm/Deals/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php index e2e089fd..b4de3801 100644 --- a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php index 18d799e1..f348e1b7 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php index 60df5e41..db752293 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObject.php index 6c0f8e63..15880d88 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php index bba95ce8..633473f3 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php index 19192c92..20097a63 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Deals * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php index 5c643d5e..4d77a48e 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php index 4345c1b9..3771e652 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Exports/Api/AdvancedApi.php b/codegen/Crm/Exports/Api/AdvancedApi.php index b32e13d0..5c87a170 100644 --- a/codegen/Crm/Exports/Api/AdvancedApi.php +++ b/codegen/Crm/Exports/Api/AdvancedApi.php @@ -380,7 +380,7 @@ public function getStatusRequest($task_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -644,7 +644,7 @@ public function startRequest($public_export_request, string $contentType = self: if (isset($public_export_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_export_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_export_request; } @@ -665,7 +665,7 @@ public function startRequest($public_export_request, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Exports/Api/BasicApi.php b/codegen/Crm/Exports/Api/BasicApi.php index cbe1fa2f..b94755cf 100644 --- a/codegen/Crm/Exports/Api/BasicApi.php +++ b/codegen/Crm/Exports/Api/BasicApi.php @@ -377,7 +377,7 @@ public function getByIdRequest($export_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Exports/Api/PublicExportsApi.php b/codegen/Crm/Exports/Api/PublicExportsApi.php deleted file mode 100644 index f34f8246..00000000 --- a/codegen/Crm/Exports/Api/PublicExportsApi.php +++ /dev/null @@ -1,1060 +0,0 @@ - [ - 'application/json', - ], - 'getStatus' => [ - 'application/json', - ], - 'start' => [ - '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 getById - * - * Retrieve details of a specific export by its unique ID. - * - * @param int $export_id The unique ID of the export to retrieve. (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\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Exports\Model\PublicExportResponse|\HubSpot\Client\Crm\Exports\Model\Error - */ - public function getById($export_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($export_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Retrieve details of a specific export by its unique ID. - * - * @param int $export_id The unique ID of the export to retrieve. (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\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Exports\Model\PublicExportResponse|\HubSpot\Client\Crm\Exports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($export_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($export_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\PublicExportResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\PublicExportResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\PublicExportResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve details of a specific export by its unique ID. - * - * @param int $export_id The unique ID of the export to retrieve. (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($export_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($export_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Retrieve details of a specific export by its unique ID. - * - * @param int $export_id The unique ID of the export to retrieve. (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($export_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Exports\Model\PublicExportResponse'; - $request = $this->getByIdRequest($export_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 $export_id The unique ID of the export to retrieve. (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($export_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'export_id' is set - if ($export_id === null || (is_array($export_id) && count($export_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $export_id when calling getById' - ); - } - - - $resourcePath = '/crm/v3/exports/export/{exportId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($export_id !== null) { - $resourcePath = str_replace( - '{' . 'exportId' . '}', - ObjectSerializer::toPathValue($export_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 getStatus - * - * Get the status of the export including the URL to download the file - * - * @param int $task_id The unique ID of the export. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI|\HubSpot\Client\Crm\Exports\Model\Error - */ - public function getStatus($task_id, string $contentType = self::contentTypes['getStatus'][0]) - { - list($response) = $this->getStatusWithHttpInfo($task_id, $contentType); - return $response; - } - - /** - * Operation getStatusWithHttpInfo - * - * Get the status of the export including the URL to download the file - * - * @param int $task_id The unique ID of the export. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI|\HubSpot\Client\Crm\Exports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getStatusWithHttpInfo($task_id, string $contentType = self::contentTypes['getStatus'][0]) - { - $request = $this->getStatusRequest($task_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getStatusAsync - * - * Get the status of the export including the URL to download the file - * - * @param int $task_id The unique ID of the export. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getStatusAsync($task_id, string $contentType = self::contentTypes['getStatus'][0]) - { - return $this->getStatusAsyncWithHttpInfo($task_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getStatusAsyncWithHttpInfo - * - * Get the status of the export including the URL to download the file - * - * @param int $task_id The unique ID of the export. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getStatusAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['getStatus'][0]) - { - $returnType = '\HubSpot\Client\Crm\Exports\Model\ActionResponseWithSingleResultURI'; - $request = $this->getStatusRequest($task_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 'getStatus' - * - * @param int $task_id The unique ID of the export. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getStatusRequest($task_id, string $contentType = self::contentTypes['getStatus'][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 $task_id when calling getStatus' - ); - } - - - $resourcePath = '/crm/v3/exports/export/async/tasks/{taskId}/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($task_id !== null) { - $resourcePath = str_replace( - '{' . 'taskId' . '}', - ObjectSerializer::toPathValue($task_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 start - * - * Start an export - * - * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request public_export_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Exports\Model\TaskLocator|\HubSpot\Client\Crm\Exports\Model\Error - */ - public function start($public_export_request, string $contentType = self::contentTypes['start'][0]) - { - list($response) = $this->startWithHttpInfo($public_export_request, $contentType); - return $response; - } - - /** - * Operation startWithHttpInfo - * - * Start an export - * - * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Exports\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Exports\Model\TaskLocator|\HubSpot\Client\Crm\Exports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function startWithHttpInfo($public_export_request, string $contentType = self::contentTypes['start'][0]) - { - $request = $this->startRequest($public_export_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 202: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\TaskLocator', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Exports\Model\TaskLocator', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\TaskLocator', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Exports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation startAsync - * - * Start an export - * - * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function startAsync($public_export_request, string $contentType = self::contentTypes['start'][0]) - { - return $this->startAsyncWithHttpInfo($public_export_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation startAsyncWithHttpInfo - * - * Start an export - * - * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function startAsyncWithHttpInfo($public_export_request, string $contentType = self::contentTypes['start'][0]) - { - $returnType = '\HubSpot\Client\Crm\Exports\Model\TaskLocator'; - $request = $this->startRequest($public_export_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 'start' - * - * @param \HubSpot\Client\Crm\Exports\Model\PublicExportRequest $public_export_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['start'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function startRequest($public_export_request, string $contentType = self::contentTypes['start'][0]) - { - - // verify the required parameter 'public_export_request' is set - if ($public_export_request === null || (is_array($public_export_request) && count($public_export_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_export_request when calling start' - ); - } - - - $resourcePath = '/crm/v3/exports/export/async'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_export_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_export_request)); - } else { - $httpBody = $public_export_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Exports/Model/StandardError.php b/codegen/Crm/Exports/Model/StandardError.php index 5103dc6f..544ed090 100644 --- a/codegen/Crm/Exports/Model/StandardError.php +++ b/codegen/Crm/Exports/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php b/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php index a61ceb5e..125c719d 100644 --- a/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php +++ b/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php @@ -358,7 +358,7 @@ public function crmV3ExtensionsCallingInboundCallRequest($completed_third_party_ if (isset($completed_third_party_call_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($completed_third_party_call_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $completed_third_party_call_request; } @@ -379,7 +379,7 @@ public function crmV3ExtensionsCallingInboundCallRequest($completed_third_party_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -587,7 +587,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con if (isset($mark_recording_as_ready_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($mark_recording_as_ready_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $mark_recording_as_ready_request; } @@ -608,7 +608,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Calling/Api/BasicApi.php b/codegen/Crm/Extensions/Calling/Api/BasicApi.php index 29c2408b..cffa26e4 100644 --- a/codegen/Crm/Extensions/Calling/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Calling/Api/BasicApi.php @@ -411,7 +411,7 @@ public function createRequest($app_id, $settings_request, string $contentType = if (isset($settings_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $settings_request; } @@ -432,16 +432,17 @@ public function createRequest($app_id, $settings_request, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -716,7 +717,7 @@ public function create_0Request($app_id, $channel_connection_settings_request, s 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 = json_encode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $channel_connection_settings_request; } @@ -737,16 +738,17 @@ public function create_0Request($app_id, $channel_connection_settings_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1021,7 +1023,7 @@ public function create_1Request($app_id, $recording_settings_request, string $co if (isset($recording_settings_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($recording_settings_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $recording_settings_request; } @@ -1042,16 +1044,17 @@ public function create_1Request($app_id, $recording_settings_request, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1315,7 +1318,7 @@ public function crmExtensionsCallingV3ConnectionStatusesRequest($user_id = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1573,7 +1576,7 @@ public function crmExtensionsCallingV3ConnectionStatusesMeRequest(string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1859,16 +1862,17 @@ public function getRequest($app_id, string $contentType = self::contentTypes['ge } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2145,16 +2149,17 @@ public function get_0Request($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2431,16 +2436,17 @@ public function get_1Request($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2661,16 +2667,17 @@ public function removeRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2891,16 +2898,17 @@ public function remove_0Request($app_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -3175,7 +3183,7 @@ public function updateRequest($app_id, $settings_patch_request, string $contentT if (isset($settings_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $settings_patch_request; } @@ -3196,16 +3204,17 @@ public function updateRequest($app_id, $settings_patch_request, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -3480,7 +3489,7 @@ public function update_0Request($app_id, $channel_connection_settings_patch_requ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $channel_connection_settings_patch_request; } @@ -3501,16 +3510,17 @@ public function update_0Request($app_id, $channel_connection_settings_patch_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -3785,7 +3795,7 @@ public function update_1Request($app_id, $recording_settings_patch_request, stri if (isset($recording_settings_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($recording_settings_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $recording_settings_patch_request; } @@ -3806,16 +3816,17 @@ public function update_1Request($app_id, $recording_settings_patch_request, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Extensions/Calling/Api/BatchApi.php b/codegen/Crm/Extensions/Calling/Api/BatchApi.php index 5a2b1314..66c9c1e3 100644 --- a/codegen/Crm/Extensions/Calling/Api/BatchApi.php +++ b/codegen/Crm/Extensions/Calling/Api/BatchApi.php @@ -347,7 +347,7 @@ public function crmExtensionsCallingV3ConnectionStatusesBatchReadRequest($batch_ if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -368,7 +368,7 @@ public function crmExtensionsCallingV3ConnectionStatusesBatchReadRequest($batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php deleted file mode 100644 index 69465182..00000000 --- a/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php +++ /dev/null @@ -1,1336 +0,0 @@ - [ - 'application/json', - ], - 'get' => [ - 'application/json', - ], - 'remove' => [ - '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 create - * - * Create new channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be created. (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 - * - * Create new channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be created. (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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - } 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); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create new channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be created. (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 - * - * Create new channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be created. (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 unique identifier of the app for which the channel connection settings are to be created. (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 get - * - * Retrieve the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be retrieved. (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\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 get($app_id, string $contentType = self::contentTypes['get'][0]) - { - list($response) = $this->getWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getWithHttpInfo - * - * Retrieve the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be retrieved. (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\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 getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $request = $this->getRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - } 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); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAsync - * - * Retrieve the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be retrieved. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) - { - return $this->getAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAsyncWithHttpInfo - * - * Retrieve the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be retrieved. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - $request = $this->getRequest($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 'get' - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be retrieved. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getRequest($app_id, string $contentType = self::contentTypes['get'][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 get' - ); - } - - - $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 remove - * - * Remove the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be deleted. (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\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function remove($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $this->removeWithHttpInfo($app_id, $contentType); - } - - /** - * Operation removeWithHttpInfo - * - * Remove the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be deleted. (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\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 removeWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $request = $this->removeRequest($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); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAsync - * - * Remove the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be deleted. (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 removeAsync($app_id, string $contentType = self::contentTypes['remove'][0]) - { - return $this->removeAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAsyncWithHttpInfo - * - * Remove the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be deleted. (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 removeAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $returnType = ''; - $request = $this->removeRequest($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 'remove' - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be deleted. (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 removeRequest($app_id, string $contentType = self::contentTypes['remove'][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 remove' - ); - } - - - $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 update - * - * Update the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be updated. (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 the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be updated. (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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $request, - $response, - ); - } 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); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be updated. (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 the channel connection settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which the channel connection settings are to be updated. (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 unique identifier of the app for which the channel connection settings are to be updated. (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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php deleted file mode 100644 index f71ae459..00000000 --- a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php +++ /dev/null @@ -1,1334 +0,0 @@ - [ - 'application/json', - ], - 'get' => [ - 'application/json', - ], - 'markAsReady' => [ - '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 create - * - * Create recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request recording_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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function create($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($app_id, $recording_settings_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($app_id, $recording_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_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, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($app_id, $recording_settings_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_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, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->createRequest($app_id, $recording_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 unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_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, $recording_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 'recording_settings_request' is set - if ($recording_settings_request === null || (is_array($recording_settings_request) && count($recording_settings_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $recording_settings_request when calling create' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/recording'; - $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($recording_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($recording_settings_request)); - } else { - $httpBody = $recording_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 get - * - * Retrieve recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (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\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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function get($app_id, string $contentType = self::contentTypes['get'][0]) - { - list($response) = $this->getWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getWithHttpInfo - * - * Retrieve recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (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\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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $request = $this->getRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAsync - * - * Retrieve recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) - { - return $this->getAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAsyncWithHttpInfo - * - * Retrieve recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->getRequest($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 'get' - * - * @param int $app_id The unique identifier for the app. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getRequest($app_id, string $contentType = self::contentTypes['get'][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 get' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/recording'; - $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 markAsReady - * - * Mark a call recording as ready for retrieval. - * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] 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 markAsReady($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) - { - $this->markAsReadyWithHttpInfo($mark_recording_as_ready_request, $contentType); - } - - /** - * Operation markAsReadyWithHttpInfo - * - * Mark a call recording as ready for retrieval. - * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] 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 markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) - { - $request = $this->markAsReadyRequest($mark_recording_as_ready_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\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation markAsReadyAsync - * - * Mark a call recording as ready for retrieval. - * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markAsReadyAsync($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) - { - return $this->markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation markAsReadyAsyncWithHttpInfo - * - * Mark a call recording as ready for retrieval. - * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) - { - $returnType = ''; - $request = $this->markAsReadyRequest($mark_recording_as_ready_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 'markAsReady' - * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function markAsReadyRequest($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) - { - - // verify the required parameter 'mark_recording_as_ready_request' is set - if ($mark_recording_as_ready_request === null || (is_array($mark_recording_as_ready_request) && count($mark_recording_as_ready_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $mark_recording_as_ready_request when calling markAsReady' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/recordings/ready'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($mark_recording_as_ready_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($mark_recording_as_ready_request)); - } else { - $httpBody = $mark_recording_as_ready_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 update - * - * Update recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request recording_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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function update($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($app_id, $recording_settings_patch_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_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\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($app_id, $recording_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_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, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($app_id, $recording_settings_patch_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update recording settings for an app. - * - * @param int $app_id The unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_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, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->updateRequest($app_id, $recording_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 unique identifier for the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_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, $recording_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 'recording_settings_patch_request' is set - if ($recording_settings_patch_request === null || (is_array($recording_settings_patch_request) && count($recording_settings_patch_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $recording_settings_patch_request when calling update' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/recording'; - $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($recording_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($recording_settings_patch_request)); - } else { - $httpBody = $recording_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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php b/codegen/Crm/Extensions/Calling/Api/SettingsApi.php deleted file mode 100644 index 43be6801..00000000 --- a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php +++ /dev/null @@ -1,1336 +0,0 @@ - [ - 'application/json', - ], - 'get' => [ - 'application/json', - ], - 'remove' => [ - '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 create - * - * Create new calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which calling extension settings are being created. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request 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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function create($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($app_id, $settings_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create new calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which calling extension settings are being created. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($app_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create new calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which calling extension settings are being created. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $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, $settings_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($app_id, $settings_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create new calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app for which calling extension settings are being created. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $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, $settings_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - $request = $this->createRequest($app_id, $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 unique identifier of the app for which calling extension settings are being created. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $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, $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 'settings_request' is set - if ($settings_request === null || (is_array($settings_request) && count($settings_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $settings_request when calling create' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings'; - $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($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($settings_request)); - } else { - $httpBody = $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 get - * - * Retrieve the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be retrieved. (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\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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function get($app_id, string $contentType = self::contentTypes['get'][0]) - { - list($response) = $this->getWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getWithHttpInfo - * - * Retrieve the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be retrieved. (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\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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $request = $this->getRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAsync - * - * Retrieve the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be retrieved. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) - { - return $this->getAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAsyncWithHttpInfo - * - * Retrieve the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be retrieved. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - $request = $this->getRequest($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 'get' - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be retrieved. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getRequest($app_id, string $contentType = self::contentTypes['get'][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 get' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings'; - $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 remove - * - * Delete the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be deleted. (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\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function remove($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $this->removeWithHttpInfo($app_id, $contentType); - } - - /** - * Operation removeWithHttpInfo - * - * Delete the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be deleted. (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\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 removeWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $request = $this->removeRequest($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); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAsync - * - * Delete the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be deleted. (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 removeAsync($app_id, string $contentType = self::contentTypes['remove'][0]) - { - return $this->removeAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAsyncWithHttpInfo - * - * Delete the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be deleted. (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 removeAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) - { - $returnType = ''; - $request = $this->removeRequest($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 'remove' - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be deleted. (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 removeRequest($app_id, string $contentType = self::contentTypes['remove'][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 remove' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings'; - $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 update - * - * Update the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be updated. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request 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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error - */ - public function update($app_id, $settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($app_id, $settings_patch_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be updated. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $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\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($app_id, $settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($app_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be updated. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $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, $settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($app_id, $settings_patch_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update the calling extension settings for a specific app. - * - * @param int $app_id The unique identifier of the app whose calling extension settings are to be updated. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $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, $settings_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - $request = $this->updateRequest($app_id, $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 unique identifier of the app whose calling extension settings are to be updated. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $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, $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 'settings_patch_request' is set - if ($settings_patch_request === null || (is_array($settings_patch_request) && count($settings_patch_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $settings_patch_request when calling update' - ); - } - - - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings'; - $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($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($settings_patch_request)); - } else { - $httpBody = $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php b/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php index 078a3643..f99bfea7 100644 --- a/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php +++ b/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function crmV3ExtensionsCardsDevAppIdViewsMigrateRequest($app_id, $card_m if (isset($card_migrate_views_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_migrate_views_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $card_migrate_views_request; } @@ -396,16 +396,17 @@ public function crmV3ExtensionsCardsDevAppIdViewsMigrateRequest($app_id, $card_m } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Extensions/Cards/Api/BasicApi.php b/codegen/Crm/Extensions/Cards/Api/BasicApi.php index 5f5637e9..fcb173db 100644 --- a/codegen/Crm/Extensions/Cards/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Cards/Api/BasicApi.php @@ -356,16 +356,17 @@ public function archiveRequest($app_id, $card_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -640,7 +641,7 @@ public function createRequest($app_id, $card_create_request, string $contentType if (isset($card_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $card_create_request; } @@ -661,16 +662,17 @@ public function createRequest($app_id, $card_create_request, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -947,16 +949,17 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1253,16 +1256,17 @@ public function getByIdRequest($app_id, $card_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1519,7 +1523,7 @@ public function getCardsSampleResponseRequest(string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1819,7 +1823,7 @@ public function updateRequest($app_id, $card_id, $card_patch_request, string $co if (isset($card_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $card_patch_request; } @@ -1840,16 +1844,17 @@ public function updateRequest($app_id, $card_id, $card_patch_request, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Extensions/Cards/Api/CardsApi.php b/codegen/Crm/Extensions/Cards/Api/CardsApi.php deleted file mode 100644 index 927fd50d..00000000 --- a/codegen/Crm/Extensions/Cards/Api/CardsApi.php +++ /dev/null @@ -1,1686 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - '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 a card - * - * @param string $card_id The ID of the card to delete. (required) - * @param int $app_id The ID of the target 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\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($card_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($card_id, $app_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a card - * - * @param string $card_id The ID of the card to delete. (required) - * @param int $app_id The ID of the target 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\Cards\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($card_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($card_id, $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\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a card - * - * @param string $card_id The ID of the card to delete. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($card_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a card - * - * @param string $card_id The ID of the card to delete. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($card_id, $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 string $card_id The ID of the card to delete. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'card_id' is set - if ($card_id === null || (is_array($card_id) && count($card_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $card_id when calling archive' - ); - } - - // 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/cards-dev/{appId}/{cardId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($card_id !== null) { - $resourcePath = str_replace( - '{' . 'cardId' . '}', - ObjectSerializer::toPathValue($card_id), - $resourcePath - ); - } - // 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 - * - * Create a new card - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardCreateRequest $card_create_request The new card definition. (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\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error - */ - public function create($app_id, $card_create_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($app_id, $card_create_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a new card - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardCreateRequest $card_create_request The new card definition. (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\Cards\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\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($app_id, $card_create_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($app_id, $card_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a new card - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardCreateRequest $card_create_request The new card definition. (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, $card_create_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($app_id, $card_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a new card - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardCreateRequest $card_create_request The new card definition. (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, $card_create_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; - $request = $this->createRequest($app_id, $card_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 'create' - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardCreateRequest $card_create_request The new card definition. (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, $card_create_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 'card_create_request' is set - if ($card_create_request === null || (is_array($card_create_request) && count($card_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $card_create_request when calling create' - ); - } - - - $resourcePath = '/crm/v3/extensions/cards-dev/{appId}'; - $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($card_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($card_create_request)); - } else { - $httpBody = $card_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 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 getAll - * - * Get all cards - * - * @param int $app_id The ID of the target app. (required) - * @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\Extensions\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error - */ - public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Get all cards - * - * @param int $app_id The ID of the target app. (required) - * @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\Extensions\Cards\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\Cards\Model\PublicCardListResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Get all cards - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Get all cards - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse'; - $request = $this->getAllRequest($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 'getAll' - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][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 getAll' - ); - } - - - $resourcePath = '/crm/v3/extensions/cards-dev/{appId}'; - $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 getById - * - * Get a card. - * - * @param string $card_id The ID of the target card. (required) - * @param int $app_id The ID of the target 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\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error - */ - public function getById($card_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($card_id, $app_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get a card. - * - * @param string $card_id The ID of the target card. (required) - * @param int $app_id The ID of the target 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\Cards\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\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($card_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($card_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get a card. - * - * @param string $card_id The ID of the target card. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($card_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get a card. - * - * @param string $card_id The ID of the target card. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; - $request = $this->getByIdRequest($card_id, $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 string $card_id The ID of the target card. (required) - * @param int $app_id The ID of the target 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($card_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'card_id' is set - if ($card_id === null || (is_array($card_id) && count($card_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $card_id when calling getById' - ); - } - - // 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/cards-dev/{appId}/{cardId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($card_id !== null) { - $resourcePath = str_replace( - '{' . 'cardId' . '}', - ObjectSerializer::toPathValue($card_id), - $resourcePath - ); - } - // 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 a card - * - * @param string $card_id The ID of the card to update. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardPatchRequest $card_patch_request Card definition fields to be updated. (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\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error - */ - public function update($card_id, $app_id, $card_patch_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($card_id, $app_id, $card_patch_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a card - * - * @param string $card_id The ID of the card to update. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardPatchRequest $card_patch_request Card definition fields to be updated. (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\Cards\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\Cards\Model\PublicCardResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($card_id, $app_id, $card_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($card_id, $app_id, $card_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a card - * - * @param string $card_id The ID of the card to update. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardPatchRequest $card_patch_request Card definition fields to be updated. (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($card_id, $app_id, $card_patch_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($card_id, $app_id, $card_patch_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a card - * - * @param string $card_id The ID of the card to update. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardPatchRequest $card_patch_request Card definition fields to be updated. (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($card_id, $app_id, $card_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; - $request = $this->updateRequest($card_id, $app_id, $card_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 string $card_id The ID of the card to update. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Extensions\Cards\Model\CardPatchRequest $card_patch_request Card definition fields to be updated. (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($card_id, $app_id, $card_patch_request, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'card_id' is set - if ($card_id === null || (is_array($card_id) && count($card_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $card_id when calling update' - ); - } - - // 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 'card_patch_request' is set - if ($card_patch_request === null || (is_array($card_patch_request) && count($card_patch_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $card_patch_request when calling update' - ); - } - - - $resourcePath = '/crm/v3/extensions/cards-dev/{appId}/{cardId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($card_id !== null) { - $resourcePath = str_replace( - '{' . 'cardId' . '}', - ObjectSerializer::toPathValue($card_id), - $resourcePath - ); - } - // 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($card_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($card_patch_request)); - } else { - $httpBody = $card_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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php b/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php deleted file mode 100644 index e16513f5..00000000 --- a/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php +++ /dev/null @@ -1,459 +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, - 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 getCardsSampleResponse - * - * Get sample card detail response - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCardsSampleResponse'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Extensions\Cards\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error - */ - public function getCardsSampleResponse(string $contentType = self::contentTypes['getCardsSampleResponse'][0]) - { - list($response) = $this->getCardsSampleResponseWithHttpInfo($contentType); - return $response; - } - - /** - * Operation getCardsSampleResponseWithHttpInfo - * - * Get sample card detail response - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCardsSampleResponse'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Extensions\Cards\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\Cards\Model\IntegratorCardPayloadResponse|\HubSpot\Client\Crm\Extensions\Cards\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getCardsSampleResponseWithHttpInfo(string $contentType = self::contentTypes['getCardsSampleResponse'][0]) - { - $request = $this->getCardsSampleResponseRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Cards\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getCardsSampleResponseAsync - * - * Get sample card detail response - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCardsSampleResponse'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCardsSampleResponseAsync(string $contentType = self::contentTypes['getCardsSampleResponse'][0]) - { - return $this->getCardsSampleResponseAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getCardsSampleResponseAsyncWithHttpInfo - * - * Get sample card detail response - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCardsSampleResponse'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getCardsSampleResponseAsyncWithHttpInfo(string $contentType = self::contentTypes['getCardsSampleResponse'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse'; - $request = $this->getCardsSampleResponseRequest($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 'getCardsSampleResponse' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCardsSampleResponse'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getCardsSampleResponseRequest(string $contentType = self::contentTypes['getCardsSampleResponse'][0]) - { - - - $resourcePath = '/crm/v3/extensions/cards-dev/sample-response'; - $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); - } - } - - - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php b/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php index 5ba4c0ab..551c4a49 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php @@ -327,16 +327,17 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -613,16 +614,17 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -897,7 +899,7 @@ public function replaceRequest($app_id, $external_settings, string $contentType if (isset($external_settings)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($external_settings), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $external_settings; } @@ -918,16 +920,17 @@ public function replaceRequest($app_id, $external_settings, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php b/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php deleted file mode 100644 index 06efc9e5..00000000 --- a/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php +++ /dev/null @@ -1,1027 +0,0 @@ - [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'replace' => [ - '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 settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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\Videoconferencing\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 settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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\Videoconferencing\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\Videoconferencing\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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 settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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 your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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/videoconferencing/settings/{appId}'; - $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 getById - * - * Get settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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\Videoconferencing\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings|\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error - */ - public function getById($app_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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\Videoconferencing\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\Videoconferencing\Model\ExternalSettings|\HubSpot\Client\Crm\Extensions\Videoconferencing\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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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 - * - * Get settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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\Videoconferencing\Model\ExternalSettings'; - $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 your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (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/videoconferencing/settings/{appId}'; - $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 replace - * - * Create or update settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (required) - * @param \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings $external_settings external_settings (required) - * @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\Extensions\Videoconferencing\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings|\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error - */ - public function replace($app_id, $external_settings, string $contentType = self::contentTypes['replace'][0]) - { - list($response) = $this->replaceWithHttpInfo($app_id, $external_settings, $contentType); - return $response; - } - - /** - * Operation replaceWithHttpInfo - * - * Create or update settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (required) - * @param \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings $external_settings (required) - * @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\Extensions\Videoconferencing\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\Videoconferencing\Model\ExternalSettings|\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function replaceWithHttpInfo($app_id, $external_settings, string $contentType = self::contentTypes['replace'][0]) - { - $request = $this->replaceRequest($app_id, $external_settings, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation replaceAsync - * - * Create or update settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (required) - * @param \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings $external_settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsync($app_id, $external_settings, string $contentType = self::contentTypes['replace'][0]) - { - return $this->replaceAsyncWithHttpInfo($app_id, $external_settings, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation replaceAsyncWithHttpInfo - * - * Create or update settings - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (required) - * @param \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings $external_settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsyncWithHttpInfo($app_id, $external_settings, string $contentType = self::contentTypes['replace'][0]) - { - $returnType = '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings'; - $request = $this->replaceRequest($app_id, $external_settings, $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 'replace' - * - * @param int $app_id the [ID of your app](https://developers.hubspot.com/docs/apps/legacy-apps/public-apps/overview) (required) - * @param \HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings $external_settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function replaceRequest($app_id, $external_settings, string $contentType = self::contentTypes['replace'][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 replace' - ); - } - - // verify the required parameter 'external_settings' is set - if ($external_settings === null || (is_array($external_settings) && count($external_settings) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_settings when calling replace' - ); - } - - - $resourcePath = '/crm/v3/extensions/videoconferencing/settings/{appId}'; - $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($external_settings)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($external_settings)); - } else { - $httpBody = $external_settings; - } - } 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( - 'PUT', - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Imports/Api/AdvancedApi.php b/codegen/Crm/Imports/Api/AdvancedApi.php index 760a9d3e..96f62220 100644 --- a/codegen/Crm/Imports/Api/AdvancedApi.php +++ b/codegen/Crm/Imports/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function crmV3ImportsRequest($files = null, $import_request = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -661,7 +661,7 @@ public function crmV3ImportsImportIdCancelRequest($import_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Imports/Api/BasicApi.php b/codegen/Crm/Imports/Api/BasicApi.php index 21d2545b..8600097f 100644 --- a/codegen/Crm/Imports/Api/BasicApi.php +++ b/codegen/Crm/Imports/Api/BasicApi.php @@ -385,7 +385,7 @@ public function crmV3ImportsRequest($after = null, $limit = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -671,7 +671,7 @@ public function crmV3ImportsImportIdRequest($import_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1017,7 +1017,7 @@ public function crmV3ImportsImportIdErrorsRequest($import_id, $after = null, $in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Imports/Api/CoreApi.php b/codegen/Crm/Imports/Api/CoreApi.php deleted file mode 100644 index 7b6a6198..00000000 --- a/codegen/Crm/Imports/Api/CoreApi.php +++ /dev/null @@ -1,1378 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'multipart/form-data', - ], - 'getById' => [ - 'application/json', - ], - 'getPage' => [ - '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 cancel - * - * Cancel an active import - * - * @param int $import_id The unique ID of the import. (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\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\ActionResponse|\HubSpot\Client\Crm\Imports\Model\Error - */ - public function cancel($import_id, string $contentType = self::contentTypes['cancel'][0]) - { - list($response) = $this->cancelWithHttpInfo($import_id, $contentType); - return $response; - } - - /** - * Operation cancelWithHttpInfo - * - * Cancel an active import - * - * @param int $import_id The unique ID of the import. (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\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\ActionResponse|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function cancelWithHttpInfo($import_id, string $contentType = self::contentTypes['cancel'][0]) - { - $request = $this->cancelRequest($import_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\ActionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\ActionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\ActionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cancelAsync - * - * Cancel an active import - * - * @param int $import_id The unique ID of the import. (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 cancelAsync($import_id, string $contentType = self::contentTypes['cancel'][0]) - { - return $this->cancelAsyncWithHttpInfo($import_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cancelAsyncWithHttpInfo - * - * Cancel an active import - * - * @param int $import_id The unique ID of the import. (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 cancelAsyncWithHttpInfo($import_id, string $contentType = self::contentTypes['cancel'][0]) - { - $returnType = '\HubSpot\Client\Crm\Imports\Model\ActionResponse'; - $request = $this->cancelRequest($import_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 'cancel' - * - * @param int $import_id The unique ID of the import. (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 cancelRequest($import_id, string $contentType = self::contentTypes['cancel'][0]) - { - - // verify the required parameter 'import_id' is set - if ($import_id === null || (is_array($import_id) && count($import_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $import_id when calling cancel' - ); - } - - - $resourcePath = '/crm/v3/imports/{importId}/cancel'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($import_id !== null) { - $resourcePath = str_replace( - '{' . 'importId' . '}', - ObjectSerializer::toPathValue($import_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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation create - * - * Start a new import - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Imports\Model\PublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error - */ - public function create($files = null, $import_request = null, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($files, $import_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Start a new import - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Imports\Model\PublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($files = null, $import_request = null, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($files, $import_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Start a new import - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAsync($files = null, $import_request = null, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($files, $import_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Start a new import - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAsyncWithHttpInfo($files = null, $import_request = null, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse'; - $request = $this->createRequest($files, $import_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 \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 - * @return \GuzzleHttp\Psr7\Request - */ - public function createRequest($files = null, $import_request = null, string $contentType = self::contentTypes['create'][0]) - { - - - - - $resourcePath = '/crm/v3/imports/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - // form params - $formDataProcessor = new FormDataProcessor(); - - $formData = $formDataProcessor->prepare([ - 'files' => $files, - 'importRequest' => $import_request, - ]); - - $formParams = $formDataProcessor->flatten($formData); - $multipart = $formDataProcessor->has_file; - - $multipart = true; - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getById - * - * Get the information on any import - * - * @param int $import_id The unique ID of the import. (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\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\PublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error - */ - public function getById($import_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($import_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get the information on any import - * - * @param int $import_id The unique ID of the import. (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\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\PublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($import_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($import_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get the information on any import - * - * @param int $import_id The unique ID of the import. (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($import_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($import_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get the information on any import - * - * @param int $import_id The unique ID of the import. (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($import_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse'; - $request = $this->getByIdRequest($import_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 $import_id The unique ID of the import. (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($import_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'import_id' is set - if ($import_id === null || (is_array($import_id) && count($import_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $import_id when calling getById' - ); - } - - - $resourcePath = '/crm/v3/imports/{importId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($import_id !== null) { - $resourcePath = str_replace( - '{' . 'importId' . '}', - ObjectSerializer::toPathValue($import_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 active imports - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error - */ - public function getPage($after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($after, $before, $limit, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get active imports - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get active imports - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($after, $before, $limit, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get active imports - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse'; - $request = $this->getPageRequest($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 'getPage' - * - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - $resourcePath = '/crm/v3/imports/'; - $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 - ) ?? []); - - - - - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Imports/Api/PublicImportsApi.php b/codegen/Crm/Imports/Api/PublicImportsApi.php deleted file mode 100644 index 3fd1f489..00000000 --- a/codegen/Crm/Imports/Api/PublicImportsApi.php +++ /dev/null @@ -1,543 +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, - 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 getErrors - * - * Retrieve errors for a specific import - * - * @param int $import_id The unique ID of the import. (required) - * @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, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) - { - list($response) = $this->getErrorsWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType); - return $response; - } - - /** - * Operation getErrorsWithHttpInfo - * - * Retrieve errors for a specific import - * - * @param int $import_id The unique ID of the import. (required) - * @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, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) - { - $request = $this->getErrorsRequest($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Imports\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getErrorsAsync - * - * Retrieve errors for a specific import - * - * @param int $import_id The unique ID of the import. (required) - * @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, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) - { - return $this->getErrorsAsyncWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getErrorsAsyncWithHttpInfo - * - * Retrieve errors for a specific import - * - * @param int $import_id The unique ID of the import. (required) - * @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, $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, $include_error_message, $include_row_data, $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 'getErrors' - * - * @param int $import_id The unique ID of the import. (required) - * @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, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) - { - - // verify the required parameter 'import_id' is set - if ($import_id === null || (is_array($import_id) && count($import_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $import_id when calling getErrors' - ); - } - - - - - - - $resourcePath = '/crm/v3/imports/{importId}/errors'; - $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( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - 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 - if ($import_id !== null) { - $resourcePath = str_replace( - '{' . 'importId' . '}', - ObjectSerializer::toPathValue($import_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php b/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php deleted file mode 100644 index eb7cffdc..00000000 --- a/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponsePublicImportResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponsePublicImportResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Imports\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse[]' - ]; - - /** - * 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\Crm\Imports\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Imports\Model\Paging|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\Crm\Imports\Model\PublicImportResponse[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Imports\Model\PublicImportResponse[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Paging.php b/codegen/Crm/Imports/Model/Paging.php deleted file mode 100644 index 7eae89d6..00000000 --- a/codegen/Crm/Imports/Model/Paging.php +++ /dev/null @@ -1,443 +0,0 @@ - - */ -class Paging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Paging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\HubSpot\Client\Crm\Imports\Model\NextPage', - 'prev' => '\HubSpot\Client\Crm\Imports\Model\PreviousPage' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null, - 'prev' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => false, - 'prev' => 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 = [ - 'next' => 'next', - 'prev' => 'prev' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext', - 'prev' => 'setPrev' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext', - 'prev' => 'getPrev' - ]; - - /** - * 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('next', $data ?? [], null); - $this->setIfExists('prev', $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 next - * - * @return \HubSpot\Client\Crm\Imports\Model\NextPage|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \HubSpot\Client\Crm\Imports\Model\NextPage|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - - /** - * Gets prev - * - * @return \HubSpot\Client\Crm\Imports\Model\PreviousPage|null - */ - public function getPrev() - { - return $this->container['prev']; - } - - /** - * Sets prev - * - * @param \HubSpot\Client\Crm\Imports\Model\PreviousPage|null $prev prev - * - * @return self - */ - public function setPrev($prev) - { - if (is_null($prev)) { - throw new \InvalidArgumentException('non-nullable prev cannot be null'); - } - $this->container['prev'] = $prev; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/PreviousPage.php b/codegen/Crm/Imports/Model/PreviousPage.php deleted file mode 100644 index a4244265..00000000 --- a/codegen/Crm/Imports/Model/PreviousPage.php +++ /dev/null @@ -1,447 +0,0 @@ - - */ -class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PreviousPage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'before' => 'string', - 'link' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'before' => null, - 'link' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'before' => false, - 'link' => 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 = [ - 'before' => 'before', - 'link' => 'link' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'before' => 'setBefore', - 'link' => 'setLink' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'before' => 'getBefore', - 'link' => 'getLink' - ]; - - /** - * 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('before', $data ?? [], null); - $this->setIfExists('link', $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['before'] === null) { - $invalidProperties[] = "'before' 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 before - * - * @return string - */ - public function getBefore() - { - return $this->container['before']; - } - - /** - * Sets before - * - * @param string $before A paging cursor token for retrieving previous pages. - * - * @return self - */ - public function setBefore($before) - { - if (is_null($before)) { - throw new \InvalidArgumentException('non-nullable before cannot be null'); - } - $this->container['before'] = $before; - - return $this; - } - - /** - * Gets link - * - * @return string|null - */ - public function getLink() - { - return $this->container['link']; - } - - /** - * Sets link - * - * @param string|null $link A URL that can be used to retrieve the previous pages' results. - * - * @return self - */ - public function setLink($link) - { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); - } - $this->container['link'] = $link; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Api/BasicApi.php b/codegen/Crm/LineItems/Api/BasicApi.php index f01a8ddc..42dcaf99 100644 --- a/codegen/Crm/LineItems/Api/BasicApi.php +++ b/codegen/Crm/LineItems/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($line_item_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($line_item_id, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($line_item_id, $simple_public_object_input, $id_pr 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($line_item_id, $simple_public_object_input, $id_pr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/LineItems/Api/BatchApi.php b/codegen/Crm/LineItems/Api/BatchApi.php index 9f4591e9..7ee93fa7 100644 --- a/codegen/Crm/LineItems/Api/BatchApi.php +++ b/codegen/Crm/LineItems/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/LineItems/Api/SearchApi.php b/codegen/Crm/LineItems/Api/SearchApi.php index 42b9f95c..190090a5 100644 --- a/codegen/Crm/LineItems/Api/SearchApi.php +++ b/codegen/Crm/LineItems/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/LineItems/Model/AssociatedId.php b/codegen/Crm/LineItems/Model/AssociatedId.php index 096c4c0f..20bf9712 100644 --- a/codegen/Crm/LineItems/Model/AssociatedId.php +++ b/codegen/Crm/LineItems/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/AssociationSpec.php b/codegen/Crm/LineItems/Model/AssociationSpec.php index fa598e94..0689619a 100644 --- a/codegen/Crm/LineItems/Model/AssociationSpec.php +++ b/codegen/Crm/LineItems/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php index 10ce3004..ae711909 100644 --- a/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php index 77a3e6a7..2d68bdec 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php index acecfd9d..e32f1df7 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index d0b5f76e..00000000 --- a/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\LineItems\Model\Paging', - 'results' => '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\LineItems\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\LineItems\Model\Paging|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\Crm\LineItems\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObject.php index 5b6a5f6b..d311fe17 100644 --- a/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObject.php b/codegen/Crm/LineItems/Model/SimplePublicObject.php index 5678b393..39d6613d 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObject.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php index 2844043c..d2da9947 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php b/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php index 33161d53..018e5da0 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\LineItems * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php index 4da38124..ceef1bad 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php index 4ea1d383..dbfa5bac 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/StandardError.php b/codegen/Crm/LineItems/Model/StandardError.php index 1b8ea1eb..d799e7e4 100644 --- a/codegen/Crm/LineItems/Model/StandardError.php +++ b/codegen/Crm/LineItems/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/LineItems/Model/ValueWithTimestamp.php b/codegen/Crm/LineItems/Model/ValueWithTimestamp.php index ca9f23e2..9fbbef80 100644 --- a/codegen/Crm/LineItems/Model/ValueWithTimestamp.php +++ b/codegen/Crm/LineItems/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Lists/Api/BasicApi.php b/codegen/Crm/Lists/Api/BasicApi.php index d6a49dd3..5bd0aae0 100644 --- a/codegen/Crm/Lists/Api/BasicApi.php +++ b/codegen/Crm/Lists/Api/BasicApi.php @@ -460,7 +460,7 @@ public function crmV3ListsRequest($include_filters = false, $list_ids = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -741,7 +741,7 @@ public function crmV3ListsFoldersRequest($folder_id = '0', string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -971,7 +971,7 @@ public function crmV3ListsFoldersFolderIdRequest($folder_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1277,7 +1277,7 @@ public function crmV3ListsFoldersFolderIdMoveNewParentFolderIdRequest($folder_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1578,7 +1578,7 @@ public function crmV3ListsFoldersFolderIdRenameRequest($folder_id, $new_folder_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1786,7 +1786,7 @@ public function crmV3ListsFoldersMoveListRequest($list_move_request, string $con if (isset($list_move_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_move_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $list_move_request; } @@ -1807,7 +1807,7 @@ public function crmV3ListsFoldersMoveListRequest($list_move_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2071,7 +2071,7 @@ public function crmV3ListsFolders_0Request($list_folder_create_request, string $ if (isset($list_folder_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_folder_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $list_folder_create_request; } @@ -2092,7 +2092,7 @@ public function crmV3ListsFolders_0Request($list_folder_create_request, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2373,7 +2373,7 @@ public function crmV3ListsIdmappingRequest($legacy_list_id = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function crmV3ListsIdmapping_0Request($request_body, string $contentType if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -2658,7 +2658,7 @@ public function crmV3ListsIdmapping_0Request($request_body, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2959,7 +2959,7 @@ public function crmV3ListsListIdRequest($list_id, $include_filters = false, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3290,7 +3290,7 @@ public function crmV3ListsListIdMembershipsRequest($list_id, $after = null, $bef } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3574,7 +3574,7 @@ public function crmV3ListsListIdMembershipsAddRequest($list_id, $request_body, s if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -3595,7 +3595,7 @@ public function crmV3ListsListIdMembershipsAddRequest($list_id, $request_body, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3879,7 +3879,7 @@ public function crmV3ListsListIdMembershipsAddAndRemoveRequest($list_id, $member if (isset($membership_change_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($membership_change_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $membership_change_request; } @@ -3900,7 +3900,7 @@ public function crmV3ListsListIdMembershipsAddAndRemoveRequest($list_id, $member } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4150,7 +4150,7 @@ public function crmV3ListsListIdMembershipsAddFromSourceListIdRequest($list_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4481,7 +4481,7 @@ public function crmV3ListsListIdMembershipsJoinOrderRequest($list_id, $after = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4765,7 +4765,7 @@ public function crmV3ListsListIdMembershipsRemoveRequest($list_id, $request_body if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -4786,7 +4786,7 @@ public function crmV3ListsListIdMembershipsRemoveRequest($list_id, $request_body } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5016,7 +5016,7 @@ public function crmV3ListsListIdMemberships_0Request($list_id, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5246,7 +5246,7 @@ public function crmV3ListsListIdRestoreRequest($list_id, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5532,7 +5532,7 @@ public function crmV3ListsListIdScheduleConversionRequest($list_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5816,7 +5816,7 @@ public function crmV3ListsListIdScheduleConversion_0Request($list_id, $public_li if (isset($public_list_conversion_time)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_list_conversion_time), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_list_conversion_time; } @@ -5837,7 +5837,7 @@ public function crmV3ListsListIdScheduleConversion_0Request($list_id, $public_li } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6067,7 +6067,7 @@ public function crmV3ListsListIdScheduleConversion_1Request($list_id, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6375,7 +6375,7 @@ public function crmV3ListsListIdSizeAndEditsHistoryBetweenRequest($list_id, $end } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6674,7 +6674,7 @@ public function crmV3ListsListIdUpdateListFiltersRequest($list_id, $list_filter_ if (isset($list_filter_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_filter_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $list_filter_update_request; } @@ -6695,7 +6695,7 @@ public function crmV3ListsListIdUpdateListFiltersRequest($list_id, $list_filter_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7011,7 +7011,7 @@ public function crmV3ListsListIdUpdateListNameRequest($list_id, $include_filters } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7241,7 +7241,7 @@ public function crmV3ListsListId_0Request($list_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7562,7 +7562,7 @@ public function crmV3ListsObjectTypeIdObjectTypeIdNameListNameRequest($list_name } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7868,7 +7868,7 @@ public function crmV3ListsRecordsObjectTypeIdRecordIdMembershipsRequest($object_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -8124,7 +8124,7 @@ public function crmV3Lists_0Request($list_create_request, string $contentType = if (isset($list_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $list_create_request; } @@ -8145,7 +8145,7 @@ public function crmV3Lists_0Request($list_create_request, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Api/BatchApi.php b/codegen/Crm/Lists/Api/BatchApi.php index 4a84bccf..1d74e34e 100644 --- a/codegen/Crm/Lists/Api/BatchApi.php +++ b/codegen/Crm/Lists/Api/BatchApi.php @@ -361,7 +361,7 @@ public function crmV3ListsRecordsMembershipsBatchReadRequest($batch_input_record if (isset($batch_input_record_id_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_record_id_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_record_id_input; } @@ -382,7 +382,7 @@ public function crmV3ListsRecordsMembershipsBatchReadRequest($batch_input_record } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Api/IDMappingApi.php b/codegen/Crm/Lists/Api/IDMappingApi.php deleted file mode 100644 index bf6fcbd5..00000000 --- a/codegen/Crm/Lists/Api/IDMappingApi.php +++ /dev/null @@ -1,766 +0,0 @@ - [ - 'application/json', - ], - 'translateLegacyListIdToListIdBatch' => [ - '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 translateLegacyListIdToListId - * - * Translate Legacy List Id to Modern List Id - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function translateLegacyListIdToListId($legacy_list_id = null, string $contentType = self::contentTypes['translateLegacyListIdToListId'][0]) - { - list($response) = $this->translateLegacyListIdToListIdWithHttpInfo($legacy_list_id, $contentType); - return $response; - } - - /** - * Operation translateLegacyListIdToListIdWithHttpInfo - * - * Translate Legacy List Id to Modern List Id - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function translateLegacyListIdToListIdWithHttpInfo($legacy_list_id = null, string $contentType = self::contentTypes['translateLegacyListIdToListId'][0]) - { - $request = $this->translateLegacyListIdToListIdRequest($legacy_list_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation translateLegacyListIdToListIdAsync - * - * Translate Legacy List Id to Modern List Id - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function translateLegacyListIdToListIdAsync($legacy_list_id = null, string $contentType = self::contentTypes['translateLegacyListIdToListId'][0]) - { - return $this->translateLegacyListIdToListIdAsyncWithHttpInfo($legacy_list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation translateLegacyListIdToListIdAsyncWithHttpInfo - * - * Translate Legacy List Id to Modern List Id - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function translateLegacyListIdToListIdAsyncWithHttpInfo($legacy_list_id = null, string $contentType = self::contentTypes['translateLegacyListIdToListId'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping'; - $request = $this->translateLegacyListIdToListIdRequest($legacy_list_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 'translateLegacyListIdToListId' - * - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function translateLegacyListIdToListIdRequest($legacy_list_id = null, string $contentType = self::contentTypes['translateLegacyListIdToListId'][0]) - { - - - - $resourcePath = '/crm/v3/lists/idmapping'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $legacy_list_id, - 'legacyListId', // 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 translateLegacyListIdToListIdBatch - * - * Translate Legacy List Id to Modern List Id in Batch - * - * @param string[] $request_body request_body (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListIdBatch'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function translateLegacyListIdToListIdBatch($request_body, string $contentType = self::contentTypes['translateLegacyListIdToListIdBatch'][0]) - { - list($response) = $this->translateLegacyListIdToListIdBatchWithHttpInfo($request_body, $contentType); - return $response; - } - - /** - * Operation translateLegacyListIdToListIdBatchWithHttpInfo - * - * Translate Legacy List Id to Modern List Id in Batch - * - * @param string[] $request_body (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListIdBatch'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function translateLegacyListIdToListIdBatchWithHttpInfo($request_body, string $contentType = self::contentTypes['translateLegacyListIdToListIdBatch'][0]) - { - $request = $this->translateLegacyListIdToListIdBatchRequest($request_body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation translateLegacyListIdToListIdBatchAsync - * - * Translate Legacy List Id to Modern List Id in Batch - * - * @param string[] $request_body (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListIdBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function translateLegacyListIdToListIdBatchAsync($request_body, string $contentType = self::contentTypes['translateLegacyListIdToListIdBatch'][0]) - { - return $this->translateLegacyListIdToListIdBatchAsyncWithHttpInfo($request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation translateLegacyListIdToListIdBatchAsyncWithHttpInfo - * - * Translate Legacy List Id to Modern List Id in Batch - * - * @param string[] $request_body (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListIdBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function translateLegacyListIdToListIdBatchAsyncWithHttpInfo($request_body, string $contentType = self::contentTypes['translateLegacyListIdToListIdBatch'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping'; - $request = $this->translateLegacyListIdToListIdBatchRequest($request_body, $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 'translateLegacyListIdToListIdBatch' - * - * @param string[] $request_body (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListIdBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function translateLegacyListIdToListIdBatchRequest($request_body, string $contentType = self::contentTypes['translateLegacyListIdToListIdBatch'][0]) - { - - // verify the required parameter 'request_body' is set - if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request_body when calling translateLegacyListIdToListIdBatch' - ); - } - - - $resourcePath = '/crm/v3/lists/idmapping'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); - } else { - $httpBody = $request_body; - } - } 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Lists/Api/JoinOrderApi.php b/codegen/Crm/Lists/Api/JoinOrderApi.php deleted file mode 100644 index 4f66d969..00000000 --- a/codegen/Crm/Lists/Api/JoinOrderApi.php +++ /dev/null @@ -1,528 +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, - 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 getPageOrderedByAddedToListDate - * - * Fetch List Memberships Ordered by Added to List Date - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getPageOrderedByAddedToListDate($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPageOrderedByAddedToListDate'][0]) - { - list($response) = $this->getPageOrderedByAddedToListDateWithHttpInfo($list_id, $after, $before, $limit, $contentType); - return $response; - } - - /** - * Operation getPageOrderedByAddedToListDateWithHttpInfo - * - * Fetch List Memberships Ordered by Added to List Date - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageOrderedByAddedToListDateWithHttpInfo($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPageOrderedByAddedToListDate'][0]) - { - $request = $this->getPageOrderedByAddedToListDateRequest($list_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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageOrderedByAddedToListDateAsync - * - * Fetch List Memberships Ordered by Added to List Date - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageOrderedByAddedToListDateAsync($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPageOrderedByAddedToListDate'][0]) - { - return $this->getPageOrderedByAddedToListDateAsyncWithHttpInfo($list_id, $after, $before, $limit, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageOrderedByAddedToListDateAsyncWithHttpInfo - * - * Fetch List Memberships Ordered by Added to List Date - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageOrderedByAddedToListDateAsyncWithHttpInfo($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPageOrderedByAddedToListDate'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId'; - $request = $this->getPageOrderedByAddedToListDateRequest($list_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 'getPageOrderedByAddedToListDate' - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageOrderedByAddedToListDateRequest($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPageOrderedByAddedToListDate'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling getPageOrderedByAddedToListDate' - ); - } - - - - - - $resourcePath = '/crm/v3/lists/{listId}/memberships/join-order'; - $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 ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Lists/Api/ListManagementApi.php b/codegen/Crm/Lists/Api/ListManagementApi.php deleted file mode 100644 index 6c2e1a4d..00000000 --- a/codegen/Crm/Lists/Api/ListManagementApi.php +++ /dev/null @@ -1,2674 +0,0 @@ - [ - 'application/json', - ], - 'createFolder' => [ - 'application/json', - ], - 'getConversionDetails' => [ - 'application/json', - ], - 'getFolder' => [ - 'application/json', - ], - 'moveFolder' => [ - 'application/json', - ], - 'moveListToFolder' => [ - 'application/json', - ], - 'removeFolder' => [ - 'application/json', - ], - 'renameFolder' => [ - 'application/json', - ], - 'scheduleOrUpdateConversion' => [ - '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 cancelConversion - * - * Cancel the conversion of a list - * - * @param string $list_id The ID of the list that you want to cancel the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelConversion'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function cancelConversion($list_id, string $contentType = self::contentTypes['cancelConversion'][0]) - { - $this->cancelConversionWithHttpInfo($list_id, $contentType); - } - - /** - * Operation cancelConversionWithHttpInfo - * - * Cancel the conversion of a list - * - * @param string $list_id The ID of the list that you want to cancel the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelConversion'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function cancelConversionWithHttpInfo($list_id, string $contentType = self::contentTypes['cancelConversion'][0]) - { - $request = $this->cancelConversionRequest($list_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation cancelConversionAsync - * - * Cancel the conversion of a list - * - * @param string $list_id The ID of the list that you want to cancel the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cancelConversionAsync($list_id, string $contentType = self::contentTypes['cancelConversion'][0]) - { - return $this->cancelConversionAsyncWithHttpInfo($list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cancelConversionAsyncWithHttpInfo - * - * Cancel the conversion of a list - * - * @param string $list_id The ID of the list that you want to cancel the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cancelConversionAsyncWithHttpInfo($list_id, string $contentType = self::contentTypes['cancelConversion'][0]) - { - $returnType = ''; - $request = $this->cancelConversionRequest($list_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 'cancelConversion' - * - * @param string $list_id The ID of the list that you want to cancel the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cancelConversionRequest($list_id, string $contentType = self::contentTypes['cancelConversion'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling cancelConversion' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/schedule-conversion'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 createFolder - * - * Creates a folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListFolderCreateRequest $list_folder_create_request list_folder_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function createFolder($list_folder_create_request, string $contentType = self::contentTypes['createFolder'][0]) - { - list($response) = $this->createFolderWithHttpInfo($list_folder_create_request, $contentType); - return $response; - } - - /** - * Operation createFolderWithHttpInfo - * - * Creates a folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListFolderCreateRequest $list_folder_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createFolderWithHttpInfo($list_folder_create_request, string $contentType = self::contentTypes['createFolder'][0]) - { - $request = $this->createFolderRequest($list_folder_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 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createFolderAsync - * - * Creates a folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListFolderCreateRequest $list_folder_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createFolderAsync($list_folder_create_request, string $contentType = self::contentTypes['createFolder'][0]) - { - return $this->createFolderAsyncWithHttpInfo($list_folder_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createFolderAsyncWithHttpInfo - * - * Creates a folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListFolderCreateRequest $list_folder_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createFolderAsyncWithHttpInfo($list_folder_create_request, string $contentType = self::contentTypes['createFolder'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse'; - $request = $this->createFolderRequest($list_folder_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 'createFolder' - * - * @param \HubSpot\Client\Crm\Lists\Model\ListFolderCreateRequest $list_folder_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createFolderRequest($list_folder_create_request, string $contentType = self::contentTypes['createFolder'][0]) - { - - // verify the required parameter 'list_folder_create_request' is set - if ($list_folder_create_request === null || (is_array($list_folder_create_request) && count($list_folder_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_folder_create_request when calling createFolder' - ); - } - - - $resourcePath = '/crm/v3/lists/folders'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($list_folder_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($list_folder_create_request)); - } else { - $httpBody = $list_folder_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 getConversionDetails - * - * Retrieve the conversion details for a list - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionDetails'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getConversionDetails($list_id, string $contentType = self::contentTypes['getConversionDetails'][0]) - { - list($response) = $this->getConversionDetailsWithHttpInfo($list_id, $contentType); - return $response; - } - - /** - * Operation getConversionDetailsWithHttpInfo - * - * Retrieve the conversion details for a list - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionDetails'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getConversionDetailsWithHttpInfo($list_id, string $contentType = self::contentTypes['getConversionDetails'][0]) - { - $request = $this->getConversionDetailsRequest($list_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getConversionDetailsAsync - * - * Retrieve the conversion details for a list - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionDetails'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getConversionDetailsAsync($list_id, string $contentType = self::contentTypes['getConversionDetails'][0]) - { - return $this->getConversionDetailsAsyncWithHttpInfo($list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getConversionDetailsAsyncWithHttpInfo - * - * Retrieve the conversion details for a list - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionDetails'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getConversionDetailsAsyncWithHttpInfo($list_id, string $contentType = self::contentTypes['getConversionDetails'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse'; - $request = $this->getConversionDetailsRequest($list_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 'getConversionDetails' - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionDetails'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getConversionDetailsRequest($list_id, string $contentType = self::contentTypes['getConversionDetails'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling getConversionDetails' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/schedule-conversion'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 getFolder - * - * Retrieves a folder. - * - * @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['getFolder'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getFolder($folder_id = '0', string $contentType = self::contentTypes['getFolder'][0]) - { - list($response) = $this->getFolderWithHttpInfo($folder_id, $contentType); - return $response; - } - - /** - * Operation getFolderWithHttpInfo - * - * Retrieves a folder. - * - * @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['getFolder'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getFolderWithHttpInfo($folder_id = '0', string $contentType = self::contentTypes['getFolder'][0]) - { - $request = $this->getFolderRequest($folder_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getFolderAsync - * - * Retrieves a folder. - * - * @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['getFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderAsync($folder_id = '0', string $contentType = self::contentTypes['getFolder'][0]) - { - return $this->getFolderAsyncWithHttpInfo($folder_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getFolderAsyncWithHttpInfo - * - * Retrieves a folder. - * - * @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['getFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getFolderAsyncWithHttpInfo($folder_id = '0', string $contentType = self::contentTypes['getFolder'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; - $request = $this->getFolderRequest($folder_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 'getFolder' - * - * @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['getFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getFolderRequest($folder_id = '0', string $contentType = self::contentTypes['getFolder'][0]) - { - - - - $resourcePath = '/crm/v3/lists/folders'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $folder_id, - 'folderId', // 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 moveFolder - * - * Moves a folder - * - * @param string $folder_id The ID of the folder to move (required) - * @param string $new_parent_folder_id The ID for the target parent folder. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveFolder'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function moveFolder($folder_id, $new_parent_folder_id, string $contentType = self::contentTypes['moveFolder'][0]) - { - list($response) = $this->moveFolderWithHttpInfo($folder_id, $new_parent_folder_id, $contentType); - return $response; - } - - /** - * Operation moveFolderWithHttpInfo - * - * Moves a folder - * - * @param string $folder_id The ID of the folder to move (required) - * @param string $new_parent_folder_id The ID for the target parent folder. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveFolder'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function moveFolderWithHttpInfo($folder_id, $new_parent_folder_id, string $contentType = self::contentTypes['moveFolder'][0]) - { - $request = $this->moveFolderRequest($folder_id, $new_parent_folder_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation moveFolderAsync - * - * Moves a folder - * - * @param string $folder_id The ID of the folder to move (required) - * @param string $new_parent_folder_id The ID for the target parent folder. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function moveFolderAsync($folder_id, $new_parent_folder_id, string $contentType = self::contentTypes['moveFolder'][0]) - { - return $this->moveFolderAsyncWithHttpInfo($folder_id, $new_parent_folder_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation moveFolderAsyncWithHttpInfo - * - * Moves a folder - * - * @param string $folder_id The ID of the folder to move (required) - * @param string $new_parent_folder_id The ID for the target parent folder. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function moveFolderAsyncWithHttpInfo($folder_id, $new_parent_folder_id, string $contentType = self::contentTypes['moveFolder'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; - $request = $this->moveFolderRequest($folder_id, $new_parent_folder_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 'moveFolder' - * - * @param string $folder_id The ID of the folder to move (required) - * @param string $new_parent_folder_id The ID for the target parent folder. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function moveFolderRequest($folder_id, $new_parent_folder_id, string $contentType = self::contentTypes['moveFolder'][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 moveFolder' - ); - } - - // verify the required parameter 'new_parent_folder_id' is set - if ($new_parent_folder_id === null || (is_array($new_parent_folder_id) && count($new_parent_folder_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $new_parent_folder_id when calling moveFolder' - ); - } - - - $resourcePath = '/crm/v3/lists/folders/{folderId}/move/{newParentFolderId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($folder_id !== null) { - $resourcePath = str_replace( - '{' . 'folderId' . '}', - ObjectSerializer::toPathValue($folder_id), - $resourcePath - ); - } - // path params - if ($new_parent_folder_id !== null) { - $resourcePath = str_replace( - '{' . 'newParentFolderId' . '}', - ObjectSerializer::toPathValue($new_parent_folder_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation moveListToFolder - * - * Moves a list to a given folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListMoveRequest $list_move_request list_move_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveListToFolder'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function moveListToFolder($list_move_request, string $contentType = self::contentTypes['moveListToFolder'][0]) - { - $this->moveListToFolderWithHttpInfo($list_move_request, $contentType); - } - - /** - * Operation moveListToFolderWithHttpInfo - * - * Moves a list to a given folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListMoveRequest $list_move_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveListToFolder'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function moveListToFolderWithHttpInfo($list_move_request, string $contentType = self::contentTypes['moveListToFolder'][0]) - { - $request = $this->moveListToFolderRequest($list_move_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\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation moveListToFolderAsync - * - * Moves a list to a given folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListMoveRequest $list_move_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveListToFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function moveListToFolderAsync($list_move_request, string $contentType = self::contentTypes['moveListToFolder'][0]) - { - return $this->moveListToFolderAsyncWithHttpInfo($list_move_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation moveListToFolderAsyncWithHttpInfo - * - * Moves a list to a given folder - * - * @param \HubSpot\Client\Crm\Lists\Model\ListMoveRequest $list_move_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveListToFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function moveListToFolderAsyncWithHttpInfo($list_move_request, string $contentType = self::contentTypes['moveListToFolder'][0]) - { - $returnType = ''; - $request = $this->moveListToFolderRequest($list_move_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 'moveListToFolder' - * - * @param \HubSpot\Client\Crm\Lists\Model\ListMoveRequest $list_move_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['moveListToFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function moveListToFolderRequest($list_move_request, string $contentType = self::contentTypes['moveListToFolder'][0]) - { - - // verify the required parameter 'list_move_request' is set - if ($list_move_request === null || (is_array($list_move_request) && count($list_move_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_move_request when calling moveListToFolder' - ); - } - - - $resourcePath = '/crm/v3/lists/folders/move-list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($list_move_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($list_move_request)); - } else { - $httpBody = $list_move_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeFolder - * - * Deletes a folder - * - * @param string $folder_id The ID of the folder to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeFolder'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function removeFolder($folder_id, string $contentType = self::contentTypes['removeFolder'][0]) - { - $this->removeFolderWithHttpInfo($folder_id, $contentType); - } - - /** - * Operation removeFolderWithHttpInfo - * - * Deletes a folder - * - * @param string $folder_id The ID of the folder to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeFolder'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeFolderWithHttpInfo($folder_id, string $contentType = self::contentTypes['removeFolder'][0]) - { - $request = $this->removeFolderRequest($folder_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeFolderAsync - * - * Deletes a folder - * - * @param string $folder_id The ID of the folder to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeFolderAsync($folder_id, string $contentType = self::contentTypes['removeFolder'][0]) - { - return $this->removeFolderAsyncWithHttpInfo($folder_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeFolderAsyncWithHttpInfo - * - * Deletes a folder - * - * @param string $folder_id The ID of the folder to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeFolderAsyncWithHttpInfo($folder_id, string $contentType = self::contentTypes['removeFolder'][0]) - { - $returnType = ''; - $request = $this->removeFolderRequest($folder_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 'removeFolder' - * - * @param string $folder_id The ID of the folder to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function removeFolderRequest($folder_id, string $contentType = self::contentTypes['removeFolder'][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 removeFolder' - ); - } - - - $resourcePath = '/crm/v3/lists/folders/{folderId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($folder_id !== null) { - $resourcePath = str_replace( - '{' . 'folderId' . '}', - ObjectSerializer::toPathValue($folder_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 renameFolder - * - * Rename a folder - * - * @param string $folder_id The ID of the folder to rename (required) - * @param string|null $new_folder_name The new name of the folder. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameFolder'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function renameFolder($folder_id, $new_folder_name = null, string $contentType = self::contentTypes['renameFolder'][0]) - { - list($response) = $this->renameFolderWithHttpInfo($folder_id, $new_folder_name, $contentType); - return $response; - } - - /** - * Operation renameFolderWithHttpInfo - * - * Rename a folder - * - * @param string $folder_id The ID of the folder to rename (required) - * @param string|null $new_folder_name The new name of the folder. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameFolder'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function renameFolderWithHttpInfo($folder_id, $new_folder_name = null, string $contentType = self::contentTypes['renameFolder'][0]) - { - $request = $this->renameFolderRequest($folder_id, $new_folder_name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation renameFolderAsync - * - * Rename a folder - * - * @param string $folder_id The ID of the folder to rename (required) - * @param string|null $new_folder_name The new name of the folder. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function renameFolderAsync($folder_id, $new_folder_name = null, string $contentType = self::contentTypes['renameFolder'][0]) - { - return $this->renameFolderAsyncWithHttpInfo($folder_id, $new_folder_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation renameFolderAsyncWithHttpInfo - * - * Rename a folder - * - * @param string $folder_id The ID of the folder to rename (required) - * @param string|null $new_folder_name The new name of the folder. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function renameFolderAsyncWithHttpInfo($folder_id, $new_folder_name = null, string $contentType = self::contentTypes['renameFolder'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; - $request = $this->renameFolderRequest($folder_id, $new_folder_name, $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 'renameFolder' - * - * @param string $folder_id The ID of the folder to rename (required) - * @param string|null $new_folder_name The new name of the folder. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['renameFolder'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function renameFolderRequest($folder_id, $new_folder_name = null, string $contentType = self::contentTypes['renameFolder'][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 renameFolder' - ); - } - - - - $resourcePath = '/crm/v3/lists/folders/{folderId}/rename'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $new_folder_name, - 'newFolderName', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($folder_id !== null) { - $resourcePath = str_replace( - '{' . 'folderId' . '}', - ObjectSerializer::toPathValue($folder_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation scheduleOrUpdateConversion - * - * Schedule or update the conversion of a list to static - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param \HubSpot\Client\Crm\Lists\Model\PublicListConversionTime $public_list_conversion_time public_list_conversion_time (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scheduleOrUpdateConversion'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function scheduleOrUpdateConversion($list_id, $public_list_conversion_time, string $contentType = self::contentTypes['scheduleOrUpdateConversion'][0]) - { - list($response) = $this->scheduleOrUpdateConversionWithHttpInfo($list_id, $public_list_conversion_time, $contentType); - return $response; - } - - /** - * Operation scheduleOrUpdateConversionWithHttpInfo - * - * Schedule or update the conversion of a list to static - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param \HubSpot\Client\Crm\Lists\Model\PublicListConversionTime $public_list_conversion_time (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scheduleOrUpdateConversion'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function scheduleOrUpdateConversionWithHttpInfo($list_id, $public_list_conversion_time, string $contentType = self::contentTypes['scheduleOrUpdateConversion'][0]) - { - $request = $this->scheduleOrUpdateConversionRequest($list_id, $public_list_conversion_time, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation scheduleOrUpdateConversionAsync - * - * Schedule or update the conversion of a list to static - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param \HubSpot\Client\Crm\Lists\Model\PublicListConversionTime $public_list_conversion_time (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scheduleOrUpdateConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function scheduleOrUpdateConversionAsync($list_id, $public_list_conversion_time, string $contentType = self::contentTypes['scheduleOrUpdateConversion'][0]) - { - return $this->scheduleOrUpdateConversionAsyncWithHttpInfo($list_id, $public_list_conversion_time, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation scheduleOrUpdateConversionAsyncWithHttpInfo - * - * Schedule or update the conversion of a list to static - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param \HubSpot\Client\Crm\Lists\Model\PublicListConversionTime $public_list_conversion_time (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scheduleOrUpdateConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function scheduleOrUpdateConversionAsyncWithHttpInfo($list_id, $public_list_conversion_time, string $contentType = self::contentTypes['scheduleOrUpdateConversion'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicListConversionResponse'; - $request = $this->scheduleOrUpdateConversionRequest($list_id, $public_list_conversion_time, $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 'scheduleOrUpdateConversion' - * - * @param string $list_id The ID of the list to schedule the conversion for. (required) - * @param \HubSpot\Client\Crm\Lists\Model\PublicListConversionTime $public_list_conversion_time (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scheduleOrUpdateConversion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function scheduleOrUpdateConversionRequest($list_id, $public_list_conversion_time, string $contentType = self::contentTypes['scheduleOrUpdateConversion'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling scheduleOrUpdateConversion' - ); - } - - // verify the required parameter 'public_list_conversion_time' is set - if ($public_list_conversion_time === null || (is_array($public_list_conversion_time) && count($public_list_conversion_time) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_list_conversion_time when calling scheduleOrUpdateConversion' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/schedule-conversion'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_list_conversion_time)) { - 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_list_conversion_time)); - } else { - $httpBody = $public_list_conversion_time; - } - } 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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Lists/Api/ListsApi.php b/codegen/Crm/Lists/Api/ListsApi.php deleted file mode 100644 index 0e5bc1c0..00000000 --- a/codegen/Crm/Lists/Api/ListsApi.php +++ /dev/null @@ -1,2805 +0,0 @@ - [ - 'application/json', - ], - 'doSearch' => [ - 'application/json', - ], - 'getAll' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getByName' => [ - 'application/json', - ], - 'remove' => [ - 'application/json', - ], - 'restore' => [ - 'application/json', - ], - 'updateListFilters' => [ - 'application/json', - ], - 'updateName' => [ - '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 create - * - * Create List - * - * @param \HubSpot\Client\Crm\Lists\Model\ListCreateRequest $list_create_request list_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\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListCreateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function create($list_create_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($list_create_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create List - * - * @param \HubSpot\Client\Crm\Lists\Model\ListCreateRequest $list_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\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListCreateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($list_create_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($list_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 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListCreateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListCreateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create List - * - * @param \HubSpot\Client\Crm\Lists\Model\ListCreateRequest $list_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 createAsync($list_create_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($list_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create List - * - * @param \HubSpot\Client\Crm\Lists\Model\ListCreateRequest $list_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 createAsyncWithHttpInfo($list_create_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListCreateResponse'; - $request = $this->createRequest($list_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 'create' - * - * @param \HubSpot\Client\Crm\Lists\Model\ListCreateRequest $list_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 createRequest($list_create_request, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'list_create_request' is set - if ($list_create_request === null || (is_array($list_create_request) && count($list_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_create_request when calling create' - ); - } - - - $resourcePath = '/crm/v3/lists/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($list_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($list_create_request)); - } else { - $httpBody = $list_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 doSearch - * - * Search Lists - * - * @param \HubSpot\Client\Crm\Lists\Model\ListSearchRequest $list_search_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListSearchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function doSearch($list_search_request, string $contentType = self::contentTypes['doSearch'][0]) - { - list($response) = $this->doSearchWithHttpInfo($list_search_request, $contentType); - return $response; - } - - /** - * Operation doSearchWithHttpInfo - * - * Search Lists - * - * @param \HubSpot\Client\Crm\Lists\Model\ListSearchRequest $list_search_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListSearchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doSearchWithHttpInfo($list_search_request, string $contentType = self::contentTypes['doSearch'][0]) - { - $request = $this->doSearchRequest($list_search_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListSearchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListSearchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListSearchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation doSearchAsync - * - * Search Lists - * - * @param \HubSpot\Client\Crm\Lists\Model\ListSearchRequest $list_search_request The IDs of the records to add and/or remove from the list. (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 doSearchAsync($list_search_request, string $contentType = self::contentTypes['doSearch'][0]) - { - return $this->doSearchAsyncWithHttpInfo($list_search_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation doSearchAsyncWithHttpInfo - * - * Search Lists - * - * @param \HubSpot\Client\Crm\Lists\Model\ListSearchRequest $list_search_request The IDs of the records to add and/or remove from the list. (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 doSearchAsyncWithHttpInfo($list_search_request, string $contentType = self::contentTypes['doSearch'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListSearchResponse'; - $request = $this->doSearchRequest($list_search_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 'doSearch' - * - * @param \HubSpot\Client\Crm\Lists\Model\ListSearchRequest $list_search_request The IDs of the records to add and/or remove from the list. (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 doSearchRequest($list_search_request, string $contentType = self::contentTypes['doSearch'][0]) - { - - // verify the required parameter 'list_search_request' is set - if ($list_search_request === null || (is_array($list_search_request) && count($list_search_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_search_request when calling doSearch' - ); - } - - - $resourcePath = '/crm/v3/lists/search'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($list_search_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($list_search_request)); - } else { - $httpBody = $list_search_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 - * - * Fetch Multiple Lists - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListsByIdResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getAll($list_ids = null, $include_filters = false, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($list_ids, $include_filters, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Fetch Multiple Lists - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListsByIdResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($list_ids = null, $include_filters = false, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($list_ids, $include_filters, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListsByIdResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListsByIdResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListsByIdResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Fetch Multiple Lists - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsync($list_ids = null, $include_filters = false, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($list_ids, $include_filters, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Fetch Multiple Lists - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsyncWithHttpInfo($list_ids = null, $include_filters = false, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListsByIdResponse'; - $request = $this->getAllRequest($list_ids, $include_filters, $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[]|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getAllRequest($list_ids = null, $include_filters = false, string $contentType = self::contentTypes['getAll'][0]) - { - - - - - $resourcePath = '/crm/v3/lists/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $list_ids, - 'listIds', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $include_filters, - 'includeFilters', // param base name - 'boolean', // 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 getById - * - * Fetch List by ID - * - * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getById($list_id, $include_filters = false, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($list_id, $include_filters, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Fetch List by ID - * - * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($list_id, $include_filters = false, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($list_id, $include_filters, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Fetch List by ID - * - * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsync($list_id, $include_filters = false, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($list_id, $include_filters, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Fetch List by ID - * - * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsyncWithHttpInfo($list_id, $include_filters = false, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse'; - $request = $this->getByIdRequest($list_id, $include_filters, $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 $list_id The **ILS ID** of the list to fetch. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByIdRequest($list_id, $include_filters = false, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling getById' - ); - } - - - - $resourcePath = '/crm/v3/lists/{listId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $include_filters, - 'includeFilters', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 getByName - * - * Fetch List by Name - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getByName($list_name, $object_type_id, $include_filters = false, string $contentType = self::contentTypes['getByName'][0]) - { - list($response) = $this->getByNameWithHttpInfo($list_name, $object_type_id, $include_filters, $contentType); - return $response; - } - - /** - * Operation getByNameWithHttpInfo - * - * Fetch List by Name - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListFetchResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByNameWithHttpInfo($list_name, $object_type_id, $include_filters = false, string $contentType = self::contentTypes['getByName'][0]) - { - $request = $this->getByNameRequest($list_name, $object_type_id, $include_filters, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByNameAsync - * - * Fetch List by Name - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByNameAsync($list_name, $object_type_id, $include_filters = false, string $contentType = self::contentTypes['getByName'][0]) - { - return $this->getByNameAsyncWithHttpInfo($list_name, $object_type_id, $include_filters, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByNameAsyncWithHttpInfo - * - * Fetch List by Name - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByNameAsyncWithHttpInfo($list_name, $object_type_id, $include_filters = false, string $contentType = self::contentTypes['getByName'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse'; - $request = $this->getByNameRequest($list_name, $object_type_id, $include_filters, $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 'getByName' - * - * @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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByNameRequest($list_name, $object_type_id, $include_filters = false, string $contentType = self::contentTypes['getByName'][0]) - { - - // verify the required parameter 'list_name' is set - if ($list_name === null || (is_array($list_name) && count($list_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_name when calling getByName' - ); - } - - // verify the required parameter 'object_type_id' is set - if ($object_type_id === null || (is_array($object_type_id) && count($object_type_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type_id when calling getByName' - ); - } - - - - $resourcePath = '/crm/v3/lists/object-type-id/{objectTypeId}/name/{listName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $include_filters, - 'includeFilters', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($list_name !== null) { - $resourcePath = str_replace( - '{' . 'listName' . '}', - ObjectSerializer::toPathValue($list_name), - $resourcePath - ); - } - // path params - if ($object_type_id !== null) { - $resourcePath = str_replace( - '{' . 'objectTypeId' . '}', - ObjectSerializer::toPathValue($object_type_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 remove - * - * Delete a List - * - * @param string $list_id The **ILS ID** of the list to delete. (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\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function remove($list_id, string $contentType = self::contentTypes['remove'][0]) - { - $this->removeWithHttpInfo($list_id, $contentType); - } - - /** - * Operation removeWithHttpInfo - * - * Delete a List - * - * @param string $list_id The **ILS ID** of the list to delete. (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\Lists\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 removeWithHttpInfo($list_id, string $contentType = self::contentTypes['remove'][0]) - { - $request = $this->removeRequest($list_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAsync - * - * Delete a List - * - * @param string $list_id The **ILS ID** of the list to delete. (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 removeAsync($list_id, string $contentType = self::contentTypes['remove'][0]) - { - return $this->removeAsyncWithHttpInfo($list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAsyncWithHttpInfo - * - * Delete a List - * - * @param string $list_id The **ILS ID** of the list to delete. (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 removeAsyncWithHttpInfo($list_id, string $contentType = self::contentTypes['remove'][0]) - { - $returnType = ''; - $request = $this->removeRequest($list_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 'remove' - * - * @param string $list_id The **ILS ID** of the list to delete. (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 removeRequest($list_id, string $contentType = self::contentTypes['remove'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling remove' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 restore - * - * Restore a List - * - * @param string $list_id The **ILS ID** of the list to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restore'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function restore($list_id, string $contentType = self::contentTypes['restore'][0]) - { - $this->restoreWithHttpInfo($list_id, $contentType); - } - - /** - * Operation restoreWithHttpInfo - * - * Restore a List - * - * @param string $list_id The **ILS ID** of the list to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restore'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function restoreWithHttpInfo($list_id, string $contentType = self::contentTypes['restore'][0]) - { - $request = $this->restoreRequest($list_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation restoreAsync - * - * Restore a List - * - * @param string $list_id The **ILS ID** of the list to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restoreAsync($list_id, string $contentType = self::contentTypes['restore'][0]) - { - return $this->restoreAsyncWithHttpInfo($list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation restoreAsyncWithHttpInfo - * - * Restore a List - * - * @param string $list_id The **ILS ID** of the list to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restoreAsyncWithHttpInfo($list_id, string $contentType = self::contentTypes['restore'][0]) - { - $returnType = ''; - $request = $this->restoreRequest($list_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 'restore' - * - * @param string $list_id The **ILS ID** of the list to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function restoreRequest($list_id, string $contentType = self::contentTypes['restore'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling restore' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/restore'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateListFilters - * - * Update List Filter Definition - * - * @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|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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function updateListFilters($list_id, $list_filter_update_request, $enroll_objects_in_workflows = false, string $contentType = self::contentTypes['updateListFilters'][0]) - { - list($response) = $this->updateListFiltersWithHttpInfo($list_id, $list_filter_update_request, $enroll_objects_in_workflows, $contentType); - return $response; - } - - /** - * Operation updateListFiltersWithHttpInfo - * - * Update List Filter Definition - * - * @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|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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateListFiltersWithHttpInfo($list_id, $list_filter_update_request, $enroll_objects_in_workflows = false, string $contentType = self::contentTypes['updateListFilters'][0]) - { - $request = $this->updateListFiltersRequest($list_id, $list_filter_update_request, $enroll_objects_in_workflows, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateListFiltersAsync - * - * Update List Filter Definition - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateListFiltersAsync($list_id, $list_filter_update_request, $enroll_objects_in_workflows = false, string $contentType = self::contentTypes['updateListFilters'][0]) - { - return $this->updateListFiltersAsyncWithHttpInfo($list_id, $list_filter_update_request, $enroll_objects_in_workflows, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateListFiltersAsyncWithHttpInfo - * - * Update List Filter Definition - * - * @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|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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateListFiltersAsyncWithHttpInfo($list_id, $list_filter_update_request, $enroll_objects_in_workflows = false, string $contentType = self::contentTypes['updateListFilters'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse'; - $request = $this->updateListFiltersRequest($list_id, $list_filter_update_request, $enroll_objects_in_workflows, $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 'updateListFilters' - * - * @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|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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateListFiltersRequest($list_id, $list_filter_update_request, $enroll_objects_in_workflows = false, string $contentType = self::contentTypes['updateListFilters'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling updateListFilters' - ); - } - - // verify the required parameter 'list_filter_update_request' is set - if ($list_filter_update_request === null || (is_array($list_filter_update_request) && count($list_filter_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_filter_update_request when calling updateListFilters' - ); - } - - - - $resourcePath = '/crm/v3/lists/{listId}/update-list-filters'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $enroll_objects_in_workflows, - 'enrollObjectsInWorkflows', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($list_filter_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($list_filter_update_request)); - } else { - $httpBody = $list_filter_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateName - * - * Update List Name - * - * @param string $list_id The **ILS ID** of the list to update. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ListUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function updateName($list_id, $list_name = null, $include_filters = false, string $contentType = self::contentTypes['updateName'][0]) - { - list($response) = $this->updateNameWithHttpInfo($list_id, $list_name, $include_filters, $contentType); - return $response; - } - - /** - * Operation updateNameWithHttpInfo - * - * Update List Name - * - * @param string $list_id The **ILS ID** of the list to update. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ListUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateNameWithHttpInfo($list_id, $list_name = null, $include_filters = false, string $contentType = self::contentTypes['updateName'][0]) - { - $request = $this->updateNameRequest($list_id, $list_name, $include_filters, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateNameAsync - * - * Update List Name - * - * @param string $list_id The **ILS ID** of the list to update. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateNameAsync($list_id, $list_name = null, $include_filters = false, string $contentType = self::contentTypes['updateName'][0]) - { - return $this->updateNameAsyncWithHttpInfo($list_id, $list_name, $include_filters, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateNameAsyncWithHttpInfo - * - * Update List Name - * - * @param string $list_id The **ILS ID** of the list to update. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateNameAsyncWithHttpInfo($list_id, $list_name = null, $include_filters = false, string $contentType = self::contentTypes['updateName'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse'; - $request = $this->updateNameRequest($list_id, $list_name, $include_filters, $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 'updateName' - * - * @param string $list_id The **ILS ID** of the list to update. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateNameRequest($list_id, $list_name = null, $include_filters = false, string $contentType = self::contentTypes['updateName'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling updateName' - ); - } - - - - - $resourcePath = '/crm/v3/lists/{listId}/update-list-name'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $list_name, - 'listName', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $include_filters, - 'includeFilters', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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( - 'PUT', - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Lists/Api/MembershipsApi.php b/codegen/Crm/Lists/Api/MembershipsApi.php deleted file mode 100644 index cac0cb20..00000000 --- a/codegen/Crm/Lists/Api/MembershipsApi.php +++ /dev/null @@ -1,2247 +0,0 @@ - [ - 'application/json', - ], - 'addAllFromList' => [ - 'application/json', - ], - 'addAndRemove' => [ - 'application/json', - ], - 'getLists' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'remove' => [ - 'application/json', - ], - 'removeAll' => [ - '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 add - * - * Add Records to a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to add to the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['add'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function add($list_id, $request_body, string $contentType = self::contentTypes['add'][0]) - { - list($response) = $this->addWithHttpInfo($list_id, $request_body, $contentType); - return $response; - } - - /** - * Operation addWithHttpInfo - * - * Add Records to a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to add to the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['add'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function addWithHttpInfo($list_id, $request_body, string $contentType = self::contentTypes['add'][0]) - { - $request = $this->addRequest($list_id, $request_body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation addAsync - * - * Add Records to a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to add to the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['add'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAsync($list_id, $request_body, string $contentType = self::contentTypes['add'][0]) - { - return $this->addAsyncWithHttpInfo($list_id, $request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addAsyncWithHttpInfo - * - * Add Records to a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to add to the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['add'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAsyncWithHttpInfo($list_id, $request_body, string $contentType = self::contentTypes['add'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; - $request = $this->addRequest($list_id, $request_body, $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 'add' - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to add to the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['add'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function addRequest($list_id, $request_body, string $contentType = self::contentTypes['add'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling add' - ); - } - - // verify the required parameter 'request_body' is set - if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request_body when calling add' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/memberships/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); - } else { - $httpBody = $request_body; - } - } 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 addAllFromList - * - * Add All Records from a Source List to a Destination List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` *destination list*, which the *source list* records are added to. (required) - * @param string $source_list_id The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAllFromList'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function addAllFromList($list_id, $source_list_id, string $contentType = self::contentTypes['addAllFromList'][0]) - { - $this->addAllFromListWithHttpInfo($list_id, $source_list_id, $contentType); - } - - /** - * Operation addAllFromListWithHttpInfo - * - * Add All Records from a Source List to a Destination List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` *destination list*, which the *source list* records are added to. (required) - * @param string $source_list_id The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAllFromList'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function addAllFromListWithHttpInfo($list_id, $source_list_id, string $contentType = self::contentTypes['addAllFromList'][0]) - { - $request = $this->addAllFromListRequest($list_id, $source_list_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation addAllFromListAsync - * - * Add All Records from a Source List to a Destination List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` *destination list*, which the *source list* records are added to. (required) - * @param string $source_list_id The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAllFromList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAllFromListAsync($list_id, $source_list_id, string $contentType = self::contentTypes['addAllFromList'][0]) - { - return $this->addAllFromListAsyncWithHttpInfo($list_id, $source_list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addAllFromListAsyncWithHttpInfo - * - * Add All Records from a Source List to a Destination List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` *destination list*, which the *source list* records are added to. (required) - * @param string $source_list_id The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAllFromList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAllFromListAsyncWithHttpInfo($list_id, $source_list_id, string $contentType = self::contentTypes['addAllFromList'][0]) - { - $returnType = ''; - $request = $this->addAllFromListRequest($list_id, $source_list_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 'addAllFromList' - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` *destination list*, which the *source list* records are added to. (required) - * @param string $source_list_id The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAllFromList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function addAllFromListRequest($list_id, $source_list_id, string $contentType = self::contentTypes['addAllFromList'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling addAllFromList' - ); - } - - // verify the required parameter 'source_list_id' is set - if ($source_list_id === null || (is_array($source_list_id) && count($source_list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $source_list_id when calling addAllFromList' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/memberships/add-from/{sourceListId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - // path params - if ($source_list_id !== null) { - $resourcePath = str_replace( - '{' . 'sourceListId' . '}', - ObjectSerializer::toPathValue($source_list_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation addAndRemove - * - * Add and/or Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param \HubSpot\Client\Crm\Lists\Model\MembershipChangeRequest $membership_change_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAndRemove'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function addAndRemove($list_id, $membership_change_request, string $contentType = self::contentTypes['addAndRemove'][0]) - { - list($response) = $this->addAndRemoveWithHttpInfo($list_id, $membership_change_request, $contentType); - return $response; - } - - /** - * Operation addAndRemoveWithHttpInfo - * - * Add and/or Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param \HubSpot\Client\Crm\Lists\Model\MembershipChangeRequest $membership_change_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAndRemove'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function addAndRemoveWithHttpInfo($list_id, $membership_change_request, string $contentType = self::contentTypes['addAndRemove'][0]) - { - $request = $this->addAndRemoveRequest($list_id, $membership_change_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation addAndRemoveAsync - * - * Add and/or Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param \HubSpot\Client\Crm\Lists\Model\MembershipChangeRequest $membership_change_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAndRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAndRemoveAsync($list_id, $membership_change_request, string $contentType = self::contentTypes['addAndRemove'][0]) - { - return $this->addAndRemoveAsyncWithHttpInfo($list_id, $membership_change_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addAndRemoveAsyncWithHttpInfo - * - * Add and/or Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param \HubSpot\Client\Crm\Lists\Model\MembershipChangeRequest $membership_change_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAndRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addAndRemoveAsyncWithHttpInfo($list_id, $membership_change_request, string $contentType = self::contentTypes['addAndRemove'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; - $request = $this->addAndRemoveRequest($list_id, $membership_change_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 'addAndRemove' - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param \HubSpot\Client\Crm\Lists\Model\MembershipChangeRequest $membership_change_request The IDs of the records to add and/or remove from the list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addAndRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function addAndRemoveRequest($list_id, $membership_change_request, string $contentType = self::contentTypes['addAndRemove'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling addAndRemove' - ); - } - - // verify the required parameter 'membership_change_request' is set - if ($membership_change_request === null || (is_array($membership_change_request) && count($membership_change_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $membership_change_request when calling addAndRemove' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/memberships/add-and-remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($membership_change_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($membership_change_request)); - } else { - $httpBody = $membership_change_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getLists - * - * Get lists record is member of - * - * @param string $object_type_id Object type id of the record (required) - * @param string $record_id Id of the record (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getLists($object_type_id, $record_id, string $contentType = self::contentTypes['getLists'][0]) - { - list($response) = $this->getListsWithHttpInfo($object_type_id, $record_id, $contentType); - return $response; - } - - /** - * Operation getListsWithHttpInfo - * - * Get lists record is member of - * - * @param string $object_type_id Object type id of the record (required) - * @param string $record_id Id of the record (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getListsWithHttpInfo($object_type_id, $record_id, string $contentType = self::contentTypes['getLists'][0]) - { - $request = $this->getListsRequest($object_type_id, $record_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getListsAsync - * - * Get lists record is member of - * - * @param string $object_type_id Object type id of the record (required) - * @param string $record_id Id of the record (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getListsAsync($object_type_id, $record_id, string $contentType = self::contentTypes['getLists'][0]) - { - return $this->getListsAsyncWithHttpInfo($object_type_id, $record_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getListsAsyncWithHttpInfo - * - * Get lists record is member of - * - * @param string $object_type_id Object type id of the record (required) - * @param string $record_id Id of the record (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getListsAsyncWithHttpInfo($object_type_id, $record_id, string $contentType = self::contentTypes['getLists'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging'; - $request = $this->getListsRequest($object_type_id, $record_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 'getLists' - * - * @param string $object_type_id Object type id of the record (required) - * @param string $record_id Id of the record (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLists'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getListsRequest($object_type_id, $record_id, string $contentType = self::contentTypes['getLists'][0]) - { - - // verify the required parameter 'object_type_id' is set - if ($object_type_id === null || (is_array($object_type_id) && count($object_type_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type_id when calling getLists' - ); - } - - // verify the required parameter 'record_id' is set - if ($record_id === null || (is_array($record_id) && count($record_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $record_id when calling getLists' - ); - } - - - $resourcePath = '/crm/v3/lists/records/{objectTypeId}/{recordId}/memberships'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type_id !== null) { - $resourcePath = str_replace( - '{' . 'objectTypeId' . '}', - ObjectSerializer::toPathValue($object_type_id), - $resourcePath - ); - } - // path params - if ($record_id !== null) { - $resourcePath = str_replace( - '{' . 'recordId' . '}', - ObjectSerializer::toPathValue($record_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 - * - * Fetch List Memberships Ordered by ID - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function getPage($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($list_id, $after, $before, $limit, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Fetch List Memberships Ordered by ID - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($list_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(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Fetch List Memberships Ordered by ID - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($list_id, $after, $before, $limit, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Fetch List Memberships Ordered by ID - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId'; - $request = $this->getPageRequest($list_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 'getPage' - * - * @param string $list_id The **ILS ID** of the list. (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($list_id, $after = null, $before = null, $limit = 100, string $contentType = self::contentTypes['getPage'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling getPage' - ); - } - - - - - - $resourcePath = '/crm/v3/lists/{listId}/memberships'; - $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 ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 remove - * - * Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to remove from the list. (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\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error - */ - public function remove($list_id, $request_body, string $contentType = self::contentTypes['remove'][0]) - { - list($response) = $this->removeWithHttpInfo($list_id, $request_body, $contentType); - return $response; - } - - /** - * Operation removeWithHttpInfo - * - * Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to remove from the list. (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\Lists\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse|\HubSpot\Client\Crm\Lists\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function removeWithHttpInfo($list_id, $request_body, string $contentType = self::contentTypes['remove'][0]) - { - $request = $this->removeRequest($list_id, $request_body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAsync - * - * Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to remove from the list. (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 removeAsync($list_id, $request_body, string $contentType = self::contentTypes['remove'][0]) - { - return $this->removeAsyncWithHttpInfo($list_id, $request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAsyncWithHttpInfo - * - * Remove Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to remove from the list. (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 removeAsyncWithHttpInfo($list_id, $request_body, string $contentType = self::contentTypes['remove'][0]) - { - $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; - $request = $this->removeRequest($list_id, $request_body, $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 'remove' - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string[] $request_body The IDs of the records to remove from the list. (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 removeRequest($list_id, $request_body, string $contentType = self::contentTypes['remove'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling remove' - ); - } - - // verify the required parameter 'request_body' is set - if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request_body when calling remove' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/memberships/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); - } else { - $httpBody = $request_body; - } - } 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 removeAll - * - * Delete All Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeAll'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function removeAll($list_id, string $contentType = self::contentTypes['removeAll'][0]) - { - $this->removeAllWithHttpInfo($list_id, $contentType); - } - - /** - * Operation removeAllWithHttpInfo - * - * Delete All Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeAll'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeAllWithHttpInfo($list_id, string $contentType = self::contentTypes['removeAll'][0]) - { - $request = $this->removeAllRequest($list_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\Lists\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation removeAllAsync - * - * Delete All Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeAll'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeAllAsync($list_id, string $contentType = self::contentTypes['removeAll'][0]) - { - return $this->removeAllAsyncWithHttpInfo($list_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeAllAsyncWithHttpInfo - * - * Delete All Records from a List - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeAll'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeAllAsyncWithHttpInfo($list_id, string $contentType = self::contentTypes['removeAll'][0]) - { - $returnType = ''; - $request = $this->removeAllRequest($list_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 'removeAll' - * - * @param string $list_id The **ILS ID** of the `MANUAL` or `SNAPSHOT` list. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeAll'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function removeAllRequest($list_id, string $contentType = self::contentTypes['removeAll'][0]) - { - - // verify the required parameter 'list_id' is set - if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $list_id when calling removeAll' - ); - } - - - $resourcePath = '/crm/v3/lists/{listId}/memberships'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($list_id !== null) { - $resourcePath = str_replace( - '{' . 'listId' . '}', - ObjectSerializer::toPathValue($list_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Lists/Api/SearchApi.php b/codegen/Crm/Lists/Api/SearchApi.php index c2174391..d9d33278 100644 --- a/codegen/Crm/Lists/Api/SearchApi.php +++ b/codegen/Crm/Lists/Api/SearchApi.php @@ -355,7 +355,7 @@ public function crmV3ListsSearchRequest($list_search_request, string $contentTyp if (isset($list_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $list_search_request; } @@ -376,7 +376,7 @@ public function crmV3ListsSearchRequest($list_search_request, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php b/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php deleted file mode 100644 index 124657c7..00000000 --- a/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class ApiCollectionResponseRecordListMembershipNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ApiCollectionResponseRecordListMembershipNoPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Lists\Model\RecordListMembership[]', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'results' => null, - 'total' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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\Lists\Model\RecordListMembership[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Lists\Model\RecordListMembership[] $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 total - * - * @return int|null - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int|null $total The total number of list memberships for the specified record. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicCampaignInfluencedFilter.php b/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php deleted file mode 100644 index a501e93a..00000000 --- a/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php +++ /dev/null @@ -1,481 +0,0 @@ - - */ -class PublicCampaignInfluencedFilter implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicCampaignInfluencedFilter'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'campaign_id' => 'string', - 'filter_type' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'campaign_id' => null, - 'filter_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'campaign_id' => false, - 'filter_type' => 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 = [ - 'campaign_id' => 'campaignId', - 'filter_type' => 'filterType' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'campaign_id' => 'setCampaignId', - 'filter_type' => 'setFilterType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'campaign_id' => 'getCampaignId', - 'filter_type' => 'getFilterType' - ]; - - /** - * 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 FILTER_TYPE_CAMPAIGN_INFLUENCED = 'CAMPAIGN_INFLUENCED'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterTypeAllowableValues() - { - return [ - self::FILTER_TYPE_CAMPAIGN_INFLUENCED, - ]; - } - - /** - * 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('campaign_id', $data ?? [], null); - $this->setIfExists('filter_type', $data ?? [], 'CAMPAIGN_INFLUENCED'); - } - - /** - * 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['campaign_id'] === null) { - $invalidProperties[] = "'campaign_id' can't be null"; - } - if ($this->container['filter_type'] === null) { - $invalidProperties[] = "'filter_type' can't be null"; - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_type', must be one of '%s'", - $this->container['filter_type'], - 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 campaign_id - * - * @return string - */ - public function getCampaignId() - { - return $this->container['campaign_id']; - } - - /** - * Sets campaign_id - * - * @param string $campaign_id The ID of the campaign that influences the filter. - * - * @return self - */ - public function setCampaignId($campaign_id) - { - if (is_null($campaign_id)) { - throw new \InvalidArgumentException('non-nullable campaign_id cannot be null'); - } - $this->container['campaign_id'] = $campaign_id; - - return $this; - } - - /** - * Gets filter_type - * - * @return string - */ - public function getFilterType() - { - return $this->container['filter_type']; - } - - /** - * Sets filter_type - * - * @param string $filter_type Indicates the type of filter (CAMPAIGN_INFLUENCED). - * - * @return self - */ - public function setFilterType($filter_type) - { - if (is_null($filter_type)) { - throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!in_array($filter_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_type', must be one of '%s'", - $filter_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_type'] = $filter_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php b/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php deleted file mode 100644 index e75bafed..00000000 --- a/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php +++ /dev/null @@ -1,1175 +0,0 @@ - - */ -class PublicFormSubmissionFilterCoalescingRefineBy implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicFormSubmissionFilter_coalescingRefineBy'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'max_occurrences' => 'int', - 'min_occurrences' => 'int', - 'type' => 'string', - 'set_type' => 'string', - 'comparison' => 'string', - 'time_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'lower_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'range_type' => 'string', - 'upper_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'timestamp' => 'int', - 'lower_timestamp' => 'int', - 'upper_timestamp' => 'int', - 'endpoint_behavior' => 'string', - 'include_objects_with_no_value_set' => 'bool', - 'operation_type' => 'string', - 'operator' => 'string', - 'property_parser' => 'string', - 'time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint', - 'lower_bound_endpoint_behavior' => 'string', - 'lower_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'string', - 'upper_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'max_occurrences' => 'int32', - 'min_occurrences' => 'int32', - 'type' => null, - 'set_type' => null, - 'comparison' => null, - 'time_offset' => null, - 'lower_bound_offset' => null, - 'range_type' => null, - 'upper_bound_offset' => null, - 'timestamp' => 'int64', - 'lower_timestamp' => 'int64', - 'upper_timestamp' => 'int64', - 'endpoint_behavior' => null, - 'include_objects_with_no_value_set' => null, - 'operation_type' => null, - 'operator' => null, - 'property_parser' => null, - 'time_point' => null, - 'lower_bound_endpoint_behavior' => null, - 'lower_bound_time_point' => null, - 'upper_bound_endpoint_behavior' => null, - 'upper_bound_time_point' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'max_occurrences' => false, - 'min_occurrences' => false, - 'type' => false, - 'set_type' => false, - 'comparison' => false, - 'time_offset' => false, - 'lower_bound_offset' => false, - 'range_type' => false, - 'upper_bound_offset' => false, - 'timestamp' => false, - 'lower_timestamp' => false, - 'upper_timestamp' => false, - 'endpoint_behavior' => false, - 'include_objects_with_no_value_set' => false, - 'operation_type' => false, - 'operator' => false, - 'property_parser' => false, - 'time_point' => false, - 'lower_bound_endpoint_behavior' => false, - 'lower_bound_time_point' => false, - 'upper_bound_endpoint_behavior' => false, - 'upper_bound_time_point' => 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 = [ - 'max_occurrences' => 'maxOccurrences', - 'min_occurrences' => 'minOccurrences', - 'type' => 'type', - 'set_type' => 'setType', - 'comparison' => 'comparison', - 'time_offset' => 'timeOffset', - 'lower_bound_offset' => 'lowerBoundOffset', - 'range_type' => 'rangeType', - 'upper_bound_offset' => 'upperBoundOffset', - 'timestamp' => 'timestamp', - 'lower_timestamp' => 'lowerTimestamp', - 'upper_timestamp' => 'upperTimestamp', - 'endpoint_behavior' => 'endpointBehavior', - 'include_objects_with_no_value_set' => 'includeObjectsWithNoValueSet', - 'operation_type' => 'operationType', - 'operator' => 'operator', - 'property_parser' => 'propertyParser', - 'time_point' => 'timePoint', - 'lower_bound_endpoint_behavior' => 'lowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'lowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'upperBoundEndpointBehavior', - 'upper_bound_time_point' => 'upperBoundTimePoint' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'max_occurrences' => 'setMaxOccurrences', - 'min_occurrences' => 'setMinOccurrences', - 'type' => 'setType', - 'set_type' => 'setSetType', - 'comparison' => 'setComparison', - 'time_offset' => 'setTimeOffset', - 'lower_bound_offset' => 'setLowerBoundOffset', - 'range_type' => 'setRangeType', - 'upper_bound_offset' => 'setUpperBoundOffset', - 'timestamp' => 'setTimestamp', - 'lower_timestamp' => 'setLowerTimestamp', - 'upper_timestamp' => 'setUpperTimestamp', - 'endpoint_behavior' => 'setEndpointBehavior', - 'include_objects_with_no_value_set' => 'setIncludeObjectsWithNoValueSet', - 'operation_type' => 'setOperationType', - 'operator' => 'setOperator', - 'property_parser' => 'setPropertyParser', - 'time_point' => 'setTimePoint', - 'lower_bound_endpoint_behavior' => 'setLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'setLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'setUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'setUpperBoundTimePoint' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'max_occurrences' => 'getMaxOccurrences', - 'min_occurrences' => 'getMinOccurrences', - 'type' => 'getType', - 'set_type' => 'getSetType', - 'comparison' => 'getComparison', - 'time_offset' => 'getTimeOffset', - 'lower_bound_offset' => 'getLowerBoundOffset', - 'range_type' => 'getRangeType', - 'upper_bound_offset' => 'getUpperBoundOffset', - 'timestamp' => 'getTimestamp', - 'lower_timestamp' => 'getLowerTimestamp', - 'upper_timestamp' => 'getUpperTimestamp', - 'endpoint_behavior' => 'getEndpointBehavior', - 'include_objects_with_no_value_set' => 'getIncludeObjectsWithNoValueSet', - 'operation_type' => 'getOperationType', - 'operator' => 'getOperator', - 'property_parser' => 'getPropertyParser', - 'time_point' => 'getTimePoint', - 'lower_bound_endpoint_behavior' => 'getLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'getLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'getUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'getUpperBoundTimePoint' - ]; - - /** - * 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('max_occurrences', $data ?? [], null); - $this->setIfExists('min_occurrences', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('set_type', $data ?? [], null); - $this->setIfExists('comparison', $data ?? [], null); - $this->setIfExists('time_offset', $data ?? [], null); - $this->setIfExists('lower_bound_offset', $data ?? [], null); - $this->setIfExists('range_type', $data ?? [], null); - $this->setIfExists('upper_bound_offset', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - $this->setIfExists('lower_timestamp', $data ?? [], null); - $this->setIfExists('upper_timestamp', $data ?? [], null); - $this->setIfExists('endpoint_behavior', $data ?? [], null); - $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); - $this->setIfExists('operation_type', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('property_parser', $data ?? [], null); - $this->setIfExists('time_point', $data ?? [], null); - $this->setIfExists('lower_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('lower_bound_time_point', $data ?? [], null); - $this->setIfExists('upper_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('upper_bound_time_point', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; - } - - /** - * 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'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - if ($this->container['set_type'] === null) { - $invalidProperties[] = "'set_type' can't be null"; - } - if ($this->container['comparison'] === null) { - $invalidProperties[] = "'comparison' can't be null"; - } - if ($this->container['time_offset'] === null) { - $invalidProperties[] = "'time_offset' can't be null"; - } - if ($this->container['lower_bound_offset'] === null) { - $invalidProperties[] = "'lower_bound_offset' can't be null"; - } - if ($this->container['range_type'] === null) { - $invalidProperties[] = "'range_type' can't be null"; - } - if ($this->container['upper_bound_offset'] === null) { - $invalidProperties[] = "'upper_bound_offset' can't be null"; - } - if ($this->container['timestamp'] === null) { - $invalidProperties[] = "'timestamp' can't be null"; - } - if ($this->container['lower_timestamp'] === null) { - $invalidProperties[] = "'lower_timestamp' can't be null"; - } - if ($this->container['upper_timestamp'] === null) { - $invalidProperties[] = "'upper_timestamp' can't be null"; - } - if ($this->container['include_objects_with_no_value_set'] === null) { - $invalidProperties[] = "'include_objects_with_no_value_set' can't be null"; - } - if ($this->container['operation_type'] === null) { - $invalidProperties[] = "'operation_type' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['time_point'] === null) { - $invalidProperties[] = "'time_point' can't be null"; - } - if ($this->container['lower_bound_time_point'] === null) { - $invalidProperties[] = "'lower_bound_time_point' can't be null"; - } - if ($this->container['upper_bound_time_point'] === null) { - $invalidProperties[] = "'upper_bound_time_point' 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 max_occurrences - * - * @return int|null - */ - public function getMaxOccurrences() - { - return $this->container['max_occurrences']; - } - - /** - * Sets max_occurrences - * - * @param int|null $max_occurrences The maximum number of occurrences allowed. - * - * @return self - */ - public function setMaxOccurrences($max_occurrences) - { - if (is_null($max_occurrences)) { - throw new \InvalidArgumentException('non-nullable max_occurrences cannot be null'); - } - $this->container['max_occurrences'] = $max_occurrences; - - return $this; - } - - /** - * Gets min_occurrences - * - * @return int|null - */ - public function getMinOccurrences() - { - return $this->container['min_occurrences']; - } - - /** - * Sets min_occurrences - * - * @param int|null $min_occurrences The minimum number of occurrences required. - * - * @return self - */ - public function setMinOccurrences($min_occurrences) - { - if (is_null($min_occurrences)) { - throw new \InvalidArgumentException('non-nullable min_occurrences cannot be null'); - } - $this->container['min_occurrences'] = $min_occurrences; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Defines the type of operation being performed. - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets set_type - * - * @return string - */ - public function getSetType() - { - return $this->container['set_type']; - } - - /** - * Sets set_type - * - * @param string $set_type Indicates the specific set type used in the refinement (ALL, ALL_INCLUDE_EMPTY, ANY, NONE, NONE_EXCLUDE_EMPTY, ANY_INCLUDE_EMPTY). - * - * @return self - */ - public function setSetType($set_type) - { - if (is_null($set_type)) { - throw new \InvalidArgumentException('non-nullable set_type cannot be null'); - } - $this->container['set_type'] = $set_type; - - return $this; - } - - /** - * Gets comparison - * - * @return string - */ - public function getComparison() - { - return $this->container['comparison']; - } - - /** - * Sets comparison - * - * @param string $comparison Timestamp comparison options (BEFORE, AFTER) - * - * @return self - */ - public function setComparison($comparison) - { - if (is_null($comparison)) { - throw new \InvalidArgumentException('non-nullable comparison cannot be null'); - } - $this->container['comparison'] = $comparison; - - return $this; - } - - /** - * Gets time_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getTimeOffset() - { - return $this->container['time_offset']; - } - - /** - * Sets time_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $time_offset time_offset - * - * @return self - */ - public function setTimeOffset($time_offset) - { - if (is_null($time_offset)) { - throw new \InvalidArgumentException('non-nullable time_offset cannot be null'); - } - $this->container['time_offset'] = $time_offset; - - return $this; - } - - /** - * Gets lower_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getLowerBoundOffset() - { - return $this->container['lower_bound_offset']; - } - - /** - * Sets lower_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $lower_bound_offset lower_bound_offset - * - * @return self - */ - public function setLowerBoundOffset($lower_bound_offset) - { - if (is_null($lower_bound_offset)) { - throw new \InvalidArgumentException('non-nullable lower_bound_offset cannot be null'); - } - $this->container['lower_bound_offset'] = $lower_bound_offset; - - return $this; - } - - /** - * Gets range_type - * - * @return string - */ - public function getRangeType() - { - return $this->container['range_type']; - } - - /** - * Sets range_type - * - * @param string $range_type Type of range of refinement critaria (BETWEEN, NOT_BETWEEN) - * - * @return self - */ - public function setRangeType($range_type) - { - if (is_null($range_type)) { - throw new \InvalidArgumentException('non-nullable range_type cannot be null'); - } - $this->container['range_type'] = $range_type; - - return $this; - } - - /** - * Gets upper_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getUpperBoundOffset() - { - return $this->container['upper_bound_offset']; - } - - /** - * Sets upper_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $upper_bound_offset upper_bound_offset - * - * @return self - */ - public function setUpperBoundOffset($upper_bound_offset) - { - if (is_null($upper_bound_offset)) { - throw new \InvalidArgumentException('non-nullable upper_bound_offset cannot be null'); - } - $this->container['upper_bound_offset'] = $upper_bound_offset; - - return $this; - } - - /** - * Gets timestamp - * - * @return int - */ - public function getTimestamp() - { - return $this->container['timestamp']; - } - - /** - * Sets timestamp - * - * @param int $timestamp Timestamp to be used in refine by criteria - * - * @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 lower_timestamp - * - * @return int - */ - public function getLowerTimestamp() - { - return $this->container['lower_timestamp']; - } - - /** - * Sets lower_timestamp - * - * @param int $lower_timestamp Lower range timestamp of refinement criteria - * - * @return self - */ - public function setLowerTimestamp($lower_timestamp) - { - if (is_null($lower_timestamp)) { - throw new \InvalidArgumentException('non-nullable lower_timestamp cannot be null'); - } - $this->container['lower_timestamp'] = $lower_timestamp; - - return $this; - } - - /** - * Gets upper_timestamp - * - * @return int - */ - public function getUpperTimestamp() - { - return $this->container['upper_timestamp']; - } - - /** - * Sets upper_timestamp - * - * @param int $upper_timestamp Upper range timestamp of refinement criteria - * - * @return self - */ - public function setUpperTimestamp($upper_timestamp) - { - if (is_null($upper_timestamp)) { - throw new \InvalidArgumentException('non-nullable upper_timestamp cannot be null'); - } - $this->container['upper_timestamp'] = $upper_timestamp; - - return $this; - } - - /** - * Gets endpoint_behavior - * - * @return string|null - */ - public function getEndpointBehavior() - { - return $this->container['endpoint_behavior']; - } - - /** - * Sets endpoint_behavior - * - * @param string|null $endpoint_behavior Describes the behavior at the endpoint of the time point operation. - * - * @return self - */ - public function setEndpointBehavior($endpoint_behavior) - { - if (is_null($endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable endpoint_behavior cannot be null'); - } - $this->container['endpoint_behavior'] = $endpoint_behavior; - - return $this; - } - - /** - * Gets include_objects_with_no_value_set - * - * @return bool - */ - public function getIncludeObjectsWithNoValueSet() - { - return $this->container['include_objects_with_no_value_set']; - } - - /** - * Sets include_objects_with_no_value_set - * - * @param bool $include_objects_with_no_value_set Indicates whether objects with no value set for the property should be included in the operation. - * - * @return self - */ - public function setIncludeObjectsWithNoValueSet($include_objects_with_no_value_set) - { - if (is_null($include_objects_with_no_value_set)) { - throw new \InvalidArgumentException('non-nullable include_objects_with_no_value_set cannot be null'); - } - $this->container['include_objects_with_no_value_set'] = $include_objects_with_no_value_set; - - return $this; - } - - /** - * Gets operation_type - * - * @return string - */ - public function getOperationType() - { - return $this->container['operation_type']; - } - - /** - * Sets operation_type - * - * @param string $operation_type Specifies the type of operation (TIME_RANGED). - * - * @return self - */ - public function setOperationType($operation_type) - { - if (is_null($operation_type)) { - throw new \InvalidArgumentException('non-nullable operation_type cannot be null'); - } - $this->container['operation_type'] = $operation_type; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied within the time range (IS_BETWEEN, IS_NOT_BETWEEN). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets property_parser - * - * @return string|null - */ - public function getPropertyParser() - { - return $this->container['property_parser']; - } - - /** - * Sets property_parser - * - * @param string|null $property_parser Specifies the parser used for the property in the operation. - * - * @return self - */ - public function setPropertyParser($property_parser) - { - if (is_null($property_parser)) { - throw new \InvalidArgumentException('non-nullable property_parser cannot be null'); - } - $this->container['property_parser'] = $property_parser; - - return $this; - } - - /** - * Gets time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint - */ - public function getTimePoint() - { - return $this->container['time_point']; - } - - /** - * Sets time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint $time_point time_point - * - * @return self - */ - public function setTimePoint($time_point) - { - if (is_null($time_point)) { - throw new \InvalidArgumentException('non-nullable time_point cannot be null'); - } - $this->container['time_point'] = $time_point; - - return $this; - } - - /** - * Gets lower_bound_endpoint_behavior - * - * @return string|null - */ - public function getLowerBoundEndpointBehavior() - { - return $this->container['lower_bound_endpoint_behavior']; - } - - /** - * Sets lower_bound_endpoint_behavior - * - * @param string|null $lower_bound_endpoint_behavior Describes the behavior at the lower bound endpoint of the time range. - * - * @return self - */ - public function setLowerBoundEndpointBehavior($lower_bound_endpoint_behavior) - { - if (is_null($lower_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable lower_bound_endpoint_behavior cannot be null'); - } - $this->container['lower_bound_endpoint_behavior'] = $lower_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets lower_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint - */ - public function getLowerBoundTimePoint() - { - return $this->container['lower_bound_time_point']; - } - - /** - * Sets lower_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint $lower_bound_time_point lower_bound_time_point - * - * @return self - */ - public function setLowerBoundTimePoint($lower_bound_time_point) - { - if (is_null($lower_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable lower_bound_time_point cannot be null'); - } - $this->container['lower_bound_time_point'] = $lower_bound_time_point; - - return $this; - } - - /** - * Gets upper_bound_endpoint_behavior - * - * @return string|null - */ - public function getUpperBoundEndpointBehavior() - { - return $this->container['upper_bound_endpoint_behavior']; - } - - /** - * Sets upper_bound_endpoint_behavior - * - * @param string|null $upper_bound_endpoint_behavior Describes the behavior at the upper bound endpoint of the time range. - * - * @return self - */ - public function setUpperBoundEndpointBehavior($upper_bound_endpoint_behavior) - { - if (is_null($upper_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable upper_bound_endpoint_behavior cannot be null'); - } - $this->container['upper_bound_endpoint_behavior'] = $upper_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets upper_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint - */ - public function getUpperBoundTimePoint() - { - return $this->container['upper_bound_time_point']; - } - - /** - * Sets upper_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint $upper_bound_time_point upper_bound_time_point - * - * @return self - */ - public function setUpperBoundTimePoint($upper_bound_time_point) - { - if (is_null($upper_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable upper_bound_time_point cannot be null'); - } - $this->container['upper_bound_time_point'] = $upper_bound_time_point; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicFormSubmissionFilterPruningRefineBy.php b/codegen/Crm/Lists/Model/PublicFormSubmissionFilterPruningRefineBy.php deleted file mode 100644 index 05be0334..00000000 --- a/codegen/Crm/Lists/Model/PublicFormSubmissionFilterPruningRefineBy.php +++ /dev/null @@ -1,1175 +0,0 @@ - - */ -class PublicFormSubmissionFilterPruningRefineBy implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicFormSubmissionFilter_pruningRefineBy'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'max_occurrences' => 'int', - 'min_occurrences' => 'int', - 'type' => 'string', - 'set_type' => 'string', - 'comparison' => 'string', - 'time_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'lower_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'range_type' => 'string', - 'upper_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'timestamp' => 'int', - 'lower_timestamp' => 'int', - 'upper_timestamp' => 'int', - 'endpoint_behavior' => 'string', - 'include_objects_with_no_value_set' => 'bool', - 'operation_type' => 'string', - 'operator' => 'string', - 'property_parser' => 'string', - 'time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint', - 'lower_bound_endpoint_behavior' => 'string', - 'lower_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'string', - 'upper_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'max_occurrences' => 'int32', - 'min_occurrences' => 'int32', - 'type' => null, - 'set_type' => null, - 'comparison' => null, - 'time_offset' => null, - 'lower_bound_offset' => null, - 'range_type' => null, - 'upper_bound_offset' => null, - 'timestamp' => 'int64', - 'lower_timestamp' => 'int64', - 'upper_timestamp' => 'int64', - 'endpoint_behavior' => null, - 'include_objects_with_no_value_set' => null, - 'operation_type' => null, - 'operator' => null, - 'property_parser' => null, - 'time_point' => null, - 'lower_bound_endpoint_behavior' => null, - 'lower_bound_time_point' => null, - 'upper_bound_endpoint_behavior' => null, - 'upper_bound_time_point' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'max_occurrences' => false, - 'min_occurrences' => false, - 'type' => false, - 'set_type' => false, - 'comparison' => false, - 'time_offset' => false, - 'lower_bound_offset' => false, - 'range_type' => false, - 'upper_bound_offset' => false, - 'timestamp' => false, - 'lower_timestamp' => false, - 'upper_timestamp' => false, - 'endpoint_behavior' => false, - 'include_objects_with_no_value_set' => false, - 'operation_type' => false, - 'operator' => false, - 'property_parser' => false, - 'time_point' => false, - 'lower_bound_endpoint_behavior' => false, - 'lower_bound_time_point' => false, - 'upper_bound_endpoint_behavior' => false, - 'upper_bound_time_point' => 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 = [ - 'max_occurrences' => 'maxOccurrences', - 'min_occurrences' => 'minOccurrences', - 'type' => 'type', - 'set_type' => 'setType', - 'comparison' => 'comparison', - 'time_offset' => 'timeOffset', - 'lower_bound_offset' => 'lowerBoundOffset', - 'range_type' => 'rangeType', - 'upper_bound_offset' => 'upperBoundOffset', - 'timestamp' => 'timestamp', - 'lower_timestamp' => 'lowerTimestamp', - 'upper_timestamp' => 'upperTimestamp', - 'endpoint_behavior' => 'endpointBehavior', - 'include_objects_with_no_value_set' => 'includeObjectsWithNoValueSet', - 'operation_type' => 'operationType', - 'operator' => 'operator', - 'property_parser' => 'propertyParser', - 'time_point' => 'timePoint', - 'lower_bound_endpoint_behavior' => 'lowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'lowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'upperBoundEndpointBehavior', - 'upper_bound_time_point' => 'upperBoundTimePoint' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'max_occurrences' => 'setMaxOccurrences', - 'min_occurrences' => 'setMinOccurrences', - 'type' => 'setType', - 'set_type' => 'setSetType', - 'comparison' => 'setComparison', - 'time_offset' => 'setTimeOffset', - 'lower_bound_offset' => 'setLowerBoundOffset', - 'range_type' => 'setRangeType', - 'upper_bound_offset' => 'setUpperBoundOffset', - 'timestamp' => 'setTimestamp', - 'lower_timestamp' => 'setLowerTimestamp', - 'upper_timestamp' => 'setUpperTimestamp', - 'endpoint_behavior' => 'setEndpointBehavior', - 'include_objects_with_no_value_set' => 'setIncludeObjectsWithNoValueSet', - 'operation_type' => 'setOperationType', - 'operator' => 'setOperator', - 'property_parser' => 'setPropertyParser', - 'time_point' => 'setTimePoint', - 'lower_bound_endpoint_behavior' => 'setLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'setLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'setUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'setUpperBoundTimePoint' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'max_occurrences' => 'getMaxOccurrences', - 'min_occurrences' => 'getMinOccurrences', - 'type' => 'getType', - 'set_type' => 'getSetType', - 'comparison' => 'getComparison', - 'time_offset' => 'getTimeOffset', - 'lower_bound_offset' => 'getLowerBoundOffset', - 'range_type' => 'getRangeType', - 'upper_bound_offset' => 'getUpperBoundOffset', - 'timestamp' => 'getTimestamp', - 'lower_timestamp' => 'getLowerTimestamp', - 'upper_timestamp' => 'getUpperTimestamp', - 'endpoint_behavior' => 'getEndpointBehavior', - 'include_objects_with_no_value_set' => 'getIncludeObjectsWithNoValueSet', - 'operation_type' => 'getOperationType', - 'operator' => 'getOperator', - 'property_parser' => 'getPropertyParser', - 'time_point' => 'getTimePoint', - 'lower_bound_endpoint_behavior' => 'getLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'getLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'getUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'getUpperBoundTimePoint' - ]; - - /** - * 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('max_occurrences', $data ?? [], null); - $this->setIfExists('min_occurrences', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('set_type', $data ?? [], null); - $this->setIfExists('comparison', $data ?? [], null); - $this->setIfExists('time_offset', $data ?? [], null); - $this->setIfExists('lower_bound_offset', $data ?? [], null); - $this->setIfExists('range_type', $data ?? [], null); - $this->setIfExists('upper_bound_offset', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - $this->setIfExists('lower_timestamp', $data ?? [], null); - $this->setIfExists('upper_timestamp', $data ?? [], null); - $this->setIfExists('endpoint_behavior', $data ?? [], null); - $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); - $this->setIfExists('operation_type', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('property_parser', $data ?? [], null); - $this->setIfExists('time_point', $data ?? [], null); - $this->setIfExists('lower_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('lower_bound_time_point', $data ?? [], null); - $this->setIfExists('upper_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('upper_bound_time_point', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; - } - - /** - * 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'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - if ($this->container['set_type'] === null) { - $invalidProperties[] = "'set_type' can't be null"; - } - if ($this->container['comparison'] === null) { - $invalidProperties[] = "'comparison' can't be null"; - } - if ($this->container['time_offset'] === null) { - $invalidProperties[] = "'time_offset' can't be null"; - } - if ($this->container['lower_bound_offset'] === null) { - $invalidProperties[] = "'lower_bound_offset' can't be null"; - } - if ($this->container['range_type'] === null) { - $invalidProperties[] = "'range_type' can't be null"; - } - if ($this->container['upper_bound_offset'] === null) { - $invalidProperties[] = "'upper_bound_offset' can't be null"; - } - if ($this->container['timestamp'] === null) { - $invalidProperties[] = "'timestamp' can't be null"; - } - if ($this->container['lower_timestamp'] === null) { - $invalidProperties[] = "'lower_timestamp' can't be null"; - } - if ($this->container['upper_timestamp'] === null) { - $invalidProperties[] = "'upper_timestamp' can't be null"; - } - if ($this->container['include_objects_with_no_value_set'] === null) { - $invalidProperties[] = "'include_objects_with_no_value_set' can't be null"; - } - if ($this->container['operation_type'] === null) { - $invalidProperties[] = "'operation_type' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['time_point'] === null) { - $invalidProperties[] = "'time_point' can't be null"; - } - if ($this->container['lower_bound_time_point'] === null) { - $invalidProperties[] = "'lower_bound_time_point' can't be null"; - } - if ($this->container['upper_bound_time_point'] === null) { - $invalidProperties[] = "'upper_bound_time_point' 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 max_occurrences - * - * @return int|null - */ - public function getMaxOccurrences() - { - return $this->container['max_occurrences']; - } - - /** - * Sets max_occurrences - * - * @param int|null $max_occurrences The maximum number of occurrences allowed. - * - * @return self - */ - public function setMaxOccurrences($max_occurrences) - { - if (is_null($max_occurrences)) { - throw new \InvalidArgumentException('non-nullable max_occurrences cannot be null'); - } - $this->container['max_occurrences'] = $max_occurrences; - - return $this; - } - - /** - * Gets min_occurrences - * - * @return int|null - */ - public function getMinOccurrences() - { - return $this->container['min_occurrences']; - } - - /** - * Sets min_occurrences - * - * @param int|null $min_occurrences The minimum number of occurrences required. - * - * @return self - */ - public function setMinOccurrences($min_occurrences) - { - if (is_null($min_occurrences)) { - throw new \InvalidArgumentException('non-nullable min_occurrences cannot be null'); - } - $this->container['min_occurrences'] = $min_occurrences; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Defines the type of operation being performed. - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets set_type - * - * @return string - */ - public function getSetType() - { - return $this->container['set_type']; - } - - /** - * Sets set_type - * - * @param string $set_type Indicates the specific set type used in the refinement (ALL, ALL_INCLUDE_EMPTY, ANY, NONE, NONE_EXCLUDE_EMPTY, ANY_INCLUDE_EMPTY). - * - * @return self - */ - public function setSetType($set_type) - { - if (is_null($set_type)) { - throw new \InvalidArgumentException('non-nullable set_type cannot be null'); - } - $this->container['set_type'] = $set_type; - - return $this; - } - - /** - * Gets comparison - * - * @return string - */ - public function getComparison() - { - return $this->container['comparison']; - } - - /** - * Sets comparison - * - * @param string $comparison Timestamp comparison options (BEFORE, AFTER) - * - * @return self - */ - public function setComparison($comparison) - { - if (is_null($comparison)) { - throw new \InvalidArgumentException('non-nullable comparison cannot be null'); - } - $this->container['comparison'] = $comparison; - - return $this; - } - - /** - * Gets time_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getTimeOffset() - { - return $this->container['time_offset']; - } - - /** - * Sets time_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $time_offset time_offset - * - * @return self - */ - public function setTimeOffset($time_offset) - { - if (is_null($time_offset)) { - throw new \InvalidArgumentException('non-nullable time_offset cannot be null'); - } - $this->container['time_offset'] = $time_offset; - - return $this; - } - - /** - * Gets lower_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getLowerBoundOffset() - { - return $this->container['lower_bound_offset']; - } - - /** - * Sets lower_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $lower_bound_offset lower_bound_offset - * - * @return self - */ - public function setLowerBoundOffset($lower_bound_offset) - { - if (is_null($lower_bound_offset)) { - throw new \InvalidArgumentException('non-nullable lower_bound_offset cannot be null'); - } - $this->container['lower_bound_offset'] = $lower_bound_offset; - - return $this; - } - - /** - * Gets range_type - * - * @return string - */ - public function getRangeType() - { - return $this->container['range_type']; - } - - /** - * Sets range_type - * - * @param string $range_type Type of range of refinement critaria (BETWEEN, NOT_BETWEEN) - * - * @return self - */ - public function setRangeType($range_type) - { - if (is_null($range_type)) { - throw new \InvalidArgumentException('non-nullable range_type cannot be null'); - } - $this->container['range_type'] = $range_type; - - return $this; - } - - /** - * Gets upper_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getUpperBoundOffset() - { - return $this->container['upper_bound_offset']; - } - - /** - * Sets upper_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $upper_bound_offset upper_bound_offset - * - * @return self - */ - public function setUpperBoundOffset($upper_bound_offset) - { - if (is_null($upper_bound_offset)) { - throw new \InvalidArgumentException('non-nullable upper_bound_offset cannot be null'); - } - $this->container['upper_bound_offset'] = $upper_bound_offset; - - return $this; - } - - /** - * Gets timestamp - * - * @return int - */ - public function getTimestamp() - { - return $this->container['timestamp']; - } - - /** - * Sets timestamp - * - * @param int $timestamp Timestamp to be used in refine by criteria - * - * @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 lower_timestamp - * - * @return int - */ - public function getLowerTimestamp() - { - return $this->container['lower_timestamp']; - } - - /** - * Sets lower_timestamp - * - * @param int $lower_timestamp Lower range timestamp of refinement criteria - * - * @return self - */ - public function setLowerTimestamp($lower_timestamp) - { - if (is_null($lower_timestamp)) { - throw new \InvalidArgumentException('non-nullable lower_timestamp cannot be null'); - } - $this->container['lower_timestamp'] = $lower_timestamp; - - return $this; - } - - /** - * Gets upper_timestamp - * - * @return int - */ - public function getUpperTimestamp() - { - return $this->container['upper_timestamp']; - } - - /** - * Sets upper_timestamp - * - * @param int $upper_timestamp Upper range timestamp of refinement criteria - * - * @return self - */ - public function setUpperTimestamp($upper_timestamp) - { - if (is_null($upper_timestamp)) { - throw new \InvalidArgumentException('non-nullable upper_timestamp cannot be null'); - } - $this->container['upper_timestamp'] = $upper_timestamp; - - return $this; - } - - /** - * Gets endpoint_behavior - * - * @return string|null - */ - public function getEndpointBehavior() - { - return $this->container['endpoint_behavior']; - } - - /** - * Sets endpoint_behavior - * - * @param string|null $endpoint_behavior Describes the behavior at the endpoint of the time point operation. - * - * @return self - */ - public function setEndpointBehavior($endpoint_behavior) - { - if (is_null($endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable endpoint_behavior cannot be null'); - } - $this->container['endpoint_behavior'] = $endpoint_behavior; - - return $this; - } - - /** - * Gets include_objects_with_no_value_set - * - * @return bool - */ - public function getIncludeObjectsWithNoValueSet() - { - return $this->container['include_objects_with_no_value_set']; - } - - /** - * Sets include_objects_with_no_value_set - * - * @param bool $include_objects_with_no_value_set Indicates whether objects with no value set for the property should be included in the operation. - * - * @return self - */ - public function setIncludeObjectsWithNoValueSet($include_objects_with_no_value_set) - { - if (is_null($include_objects_with_no_value_set)) { - throw new \InvalidArgumentException('non-nullable include_objects_with_no_value_set cannot be null'); - } - $this->container['include_objects_with_no_value_set'] = $include_objects_with_no_value_set; - - return $this; - } - - /** - * Gets operation_type - * - * @return string - */ - public function getOperationType() - { - return $this->container['operation_type']; - } - - /** - * Sets operation_type - * - * @param string $operation_type Specifies the type of operation (TIME_RANGED). - * - * @return self - */ - public function setOperationType($operation_type) - { - if (is_null($operation_type)) { - throw new \InvalidArgumentException('non-nullable operation_type cannot be null'); - } - $this->container['operation_type'] = $operation_type; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied within the time range (IS_BETWEEN, IS_NOT_BETWEEN). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets property_parser - * - * @return string|null - */ - public function getPropertyParser() - { - return $this->container['property_parser']; - } - - /** - * Sets property_parser - * - * @param string|null $property_parser Specifies the parser used for the property in the operation. - * - * @return self - */ - public function setPropertyParser($property_parser) - { - if (is_null($property_parser)) { - throw new \InvalidArgumentException('non-nullable property_parser cannot be null'); - } - $this->container['property_parser'] = $property_parser; - - return $this; - } - - /** - * Gets time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint - */ - public function getTimePoint() - { - return $this->container['time_point']; - } - - /** - * Sets time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint $time_point time_point - * - * @return self - */ - public function setTimePoint($time_point) - { - if (is_null($time_point)) { - throw new \InvalidArgumentException('non-nullable time_point cannot be null'); - } - $this->container['time_point'] = $time_point; - - return $this; - } - - /** - * Gets lower_bound_endpoint_behavior - * - * @return string|null - */ - public function getLowerBoundEndpointBehavior() - { - return $this->container['lower_bound_endpoint_behavior']; - } - - /** - * Sets lower_bound_endpoint_behavior - * - * @param string|null $lower_bound_endpoint_behavior Describes the behavior at the lower bound endpoint of the time range. - * - * @return self - */ - public function setLowerBoundEndpointBehavior($lower_bound_endpoint_behavior) - { - if (is_null($lower_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable lower_bound_endpoint_behavior cannot be null'); - } - $this->container['lower_bound_endpoint_behavior'] = $lower_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets lower_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint - */ - public function getLowerBoundTimePoint() - { - return $this->container['lower_bound_time_point']; - } - - /** - * Sets lower_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint $lower_bound_time_point lower_bound_time_point - * - * @return self - */ - public function setLowerBoundTimePoint($lower_bound_time_point) - { - if (is_null($lower_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable lower_bound_time_point cannot be null'); - } - $this->container['lower_bound_time_point'] = $lower_bound_time_point; - - return $this; - } - - /** - * Gets upper_bound_endpoint_behavior - * - * @return string|null - */ - public function getUpperBoundEndpointBehavior() - { - return $this->container['upper_bound_endpoint_behavior']; - } - - /** - * Sets upper_bound_endpoint_behavior - * - * @param string|null $upper_bound_endpoint_behavior Describes the behavior at the upper bound endpoint of the time range. - * - * @return self - */ - public function setUpperBoundEndpointBehavior($upper_bound_endpoint_behavior) - { - if (is_null($upper_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable upper_bound_endpoint_behavior cannot be null'); - } - $this->container['upper_bound_endpoint_behavior'] = $upper_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets upper_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint - */ - public function getUpperBoundTimePoint() - { - return $this->container['upper_bound_time_point']; - } - - /** - * Sets upper_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint $upper_bound_time_point upper_bound_time_point - * - * @return self - */ - public function setUpperBoundTimePoint($upper_bound_time_point) - { - if (is_null($upper_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable upper_bound_time_point cannot be null'); - } - $this->container['upper_bound_time_point'] = $upper_bound_time_point; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicNumAssociationsFilter.php b/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php deleted file mode 100644 index 677b29d2..00000000 --- a/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php +++ /dev/null @@ -1,555 +0,0 @@ - - */ -class PublicNumAssociationsFilter implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicNumAssociationsFilter'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'association_category' => 'string', - 'association_type_id' => 'int', - 'coalescing_refine_by' => '\HubSpot\Client\Crm\Lists\Model\PublicNumAssociationsFilterCoalescingRefineBy', - 'filter_type' => 'string' - ]; - - /** - * 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', - 'coalescing_refine_by' => null, - 'filter_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'association_category' => false, - 'association_type_id' => false, - 'coalescing_refine_by' => false, - 'filter_type' => 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', - 'coalescing_refine_by' => 'coalescingRefineBy', - 'filter_type' => 'filterType' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'association_category' => 'setAssociationCategory', - 'association_type_id' => 'setAssociationTypeId', - 'coalescing_refine_by' => 'setCoalescingRefineBy', - 'filter_type' => 'setFilterType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'association_category' => 'getAssociationCategory', - 'association_type_id' => 'getAssociationTypeId', - 'coalescing_refine_by' => 'getCoalescingRefineBy', - 'filter_type' => 'getFilterType' - ]; - - /** - * 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 FILTER_TYPE_NUM_ASSOCIATIONS = 'NUM_ASSOCIATIONS'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterTypeAllowableValues() - { - return [ - self::FILTER_TYPE_NUM_ASSOCIATIONS, - ]; - } - - /** - * 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); - $this->setIfExists('coalescing_refine_by', $data ?? [], null); - $this->setIfExists('filter_type', $data ?? [], 'NUM_ASSOCIATIONS'); - } - - /** - * 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"; - } - if ($this->container['association_type_id'] === null) { - $invalidProperties[] = "'association_type_id' can't be null"; - } - if ($this->container['coalescing_refine_by'] === null) { - $invalidProperties[] = "'coalescing_refine_by' can't be null"; - } - if ($this->container['filter_type'] === null) { - $invalidProperties[] = "'filter_type' can't be null"; - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_type', must be one of '%s'", - $this->container['filter_type'], - 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 association_category - * - * @return string - */ - public function getAssociationCategory() - { - return $this->container['association_category']; - } - - /** - * Sets association_category - * - * @param string $association_category Defines the category of the association (HUBSPOT_DEFINED, USER_DEFINED, INTEGRATOR_DEFINED, WORK). - * - * @return self - */ - public function setAssociationCategory($association_category) - { - if (is_null($association_category)) { - throw new \InvalidArgumentException('non-nullable association_category cannot be null'); - } - $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 The ID representing the type of association being filtered. - * - * @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; - } - - /** - * Gets coalescing_refine_by - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicNumAssociationsFilterCoalescingRefineBy - */ - public function getCoalescingRefineBy() - { - return $this->container['coalescing_refine_by']; - } - - /** - * Sets coalescing_refine_by - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicNumAssociationsFilterCoalescingRefineBy $coalescing_refine_by coalescing_refine_by - * - * @return self - */ - public function setCoalescingRefineBy($coalescing_refine_by) - { - if (is_null($coalescing_refine_by)) { - throw new \InvalidArgumentException('non-nullable coalescing_refine_by cannot be null'); - } - $this->container['coalescing_refine_by'] = $coalescing_refine_by; - - return $this; - } - - /** - * Gets filter_type - * - * @return string - */ - public function getFilterType() - { - return $this->container['filter_type']; - } - - /** - * Sets filter_type - * - * @param string $filter_type Indicates the type of filter being applied (NUM_ASSOCIATIONS). - * - * @return self - */ - public function setFilterType($filter_type) - { - if (is_null($filter_type)) { - throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!in_array($filter_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_type', must be one of '%s'", - $filter_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_type'] = $filter_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicNumAssociationsFilterCoalescingRefineBy.php b/codegen/Crm/Lists/Model/PublicNumAssociationsFilterCoalescingRefineBy.php deleted file mode 100644 index 2cd30cf2..00000000 --- a/codegen/Crm/Lists/Model/PublicNumAssociationsFilterCoalescingRefineBy.php +++ /dev/null @@ -1,1175 +0,0 @@ - - */ -class PublicNumAssociationsFilterCoalescingRefineBy implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicNumAssociationsFilter_coalescingRefineBy'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'max_occurrences' => 'int', - 'min_occurrences' => 'int', - 'type' => 'string', - 'set_type' => 'string', - 'comparison' => 'string', - 'time_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'lower_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'range_type' => 'string', - 'upper_bound_offset' => '\HubSpot\Client\Crm\Lists\Model\PublicTimeOffset', - 'timestamp' => 'int', - 'lower_timestamp' => 'int', - 'upper_timestamp' => 'int', - 'endpoint_behavior' => 'string', - 'include_objects_with_no_value_set' => 'bool', - 'operation_type' => 'string', - 'operator' => 'string', - 'property_parser' => 'string', - 'time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint', - 'lower_bound_endpoint_behavior' => 'string', - 'lower_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'string', - 'upper_bound_time_point' => '\HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'max_occurrences' => 'int32', - 'min_occurrences' => 'int32', - 'type' => null, - 'set_type' => null, - 'comparison' => null, - 'time_offset' => null, - 'lower_bound_offset' => null, - 'range_type' => null, - 'upper_bound_offset' => null, - 'timestamp' => 'int64', - 'lower_timestamp' => 'int64', - 'upper_timestamp' => 'int64', - 'endpoint_behavior' => null, - 'include_objects_with_no_value_set' => null, - 'operation_type' => null, - 'operator' => null, - 'property_parser' => null, - 'time_point' => null, - 'lower_bound_endpoint_behavior' => null, - 'lower_bound_time_point' => null, - 'upper_bound_endpoint_behavior' => null, - 'upper_bound_time_point' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'max_occurrences' => false, - 'min_occurrences' => false, - 'type' => false, - 'set_type' => false, - 'comparison' => false, - 'time_offset' => false, - 'lower_bound_offset' => false, - 'range_type' => false, - 'upper_bound_offset' => false, - 'timestamp' => false, - 'lower_timestamp' => false, - 'upper_timestamp' => false, - 'endpoint_behavior' => false, - 'include_objects_with_no_value_set' => false, - 'operation_type' => false, - 'operator' => false, - 'property_parser' => false, - 'time_point' => false, - 'lower_bound_endpoint_behavior' => false, - 'lower_bound_time_point' => false, - 'upper_bound_endpoint_behavior' => false, - 'upper_bound_time_point' => 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 = [ - 'max_occurrences' => 'maxOccurrences', - 'min_occurrences' => 'minOccurrences', - 'type' => 'type', - 'set_type' => 'setType', - 'comparison' => 'comparison', - 'time_offset' => 'timeOffset', - 'lower_bound_offset' => 'lowerBoundOffset', - 'range_type' => 'rangeType', - 'upper_bound_offset' => 'upperBoundOffset', - 'timestamp' => 'timestamp', - 'lower_timestamp' => 'lowerTimestamp', - 'upper_timestamp' => 'upperTimestamp', - 'endpoint_behavior' => 'endpointBehavior', - 'include_objects_with_no_value_set' => 'includeObjectsWithNoValueSet', - 'operation_type' => 'operationType', - 'operator' => 'operator', - 'property_parser' => 'propertyParser', - 'time_point' => 'timePoint', - 'lower_bound_endpoint_behavior' => 'lowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'lowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'upperBoundEndpointBehavior', - 'upper_bound_time_point' => 'upperBoundTimePoint' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'max_occurrences' => 'setMaxOccurrences', - 'min_occurrences' => 'setMinOccurrences', - 'type' => 'setType', - 'set_type' => 'setSetType', - 'comparison' => 'setComparison', - 'time_offset' => 'setTimeOffset', - 'lower_bound_offset' => 'setLowerBoundOffset', - 'range_type' => 'setRangeType', - 'upper_bound_offset' => 'setUpperBoundOffset', - 'timestamp' => 'setTimestamp', - 'lower_timestamp' => 'setLowerTimestamp', - 'upper_timestamp' => 'setUpperTimestamp', - 'endpoint_behavior' => 'setEndpointBehavior', - 'include_objects_with_no_value_set' => 'setIncludeObjectsWithNoValueSet', - 'operation_type' => 'setOperationType', - 'operator' => 'setOperator', - 'property_parser' => 'setPropertyParser', - 'time_point' => 'setTimePoint', - 'lower_bound_endpoint_behavior' => 'setLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'setLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'setUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'setUpperBoundTimePoint' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'max_occurrences' => 'getMaxOccurrences', - 'min_occurrences' => 'getMinOccurrences', - 'type' => 'getType', - 'set_type' => 'getSetType', - 'comparison' => 'getComparison', - 'time_offset' => 'getTimeOffset', - 'lower_bound_offset' => 'getLowerBoundOffset', - 'range_type' => 'getRangeType', - 'upper_bound_offset' => 'getUpperBoundOffset', - 'timestamp' => 'getTimestamp', - 'lower_timestamp' => 'getLowerTimestamp', - 'upper_timestamp' => 'getUpperTimestamp', - 'endpoint_behavior' => 'getEndpointBehavior', - 'include_objects_with_no_value_set' => 'getIncludeObjectsWithNoValueSet', - 'operation_type' => 'getOperationType', - 'operator' => 'getOperator', - 'property_parser' => 'getPropertyParser', - 'time_point' => 'getTimePoint', - 'lower_bound_endpoint_behavior' => 'getLowerBoundEndpointBehavior', - 'lower_bound_time_point' => 'getLowerBoundTimePoint', - 'upper_bound_endpoint_behavior' => 'getUpperBoundEndpointBehavior', - 'upper_bound_time_point' => 'getUpperBoundTimePoint' - ]; - - /** - * 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('max_occurrences', $data ?? [], null); - $this->setIfExists('min_occurrences', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('set_type', $data ?? [], null); - $this->setIfExists('comparison', $data ?? [], null); - $this->setIfExists('time_offset', $data ?? [], null); - $this->setIfExists('lower_bound_offset', $data ?? [], null); - $this->setIfExists('range_type', $data ?? [], null); - $this->setIfExists('upper_bound_offset', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - $this->setIfExists('lower_timestamp', $data ?? [], null); - $this->setIfExists('upper_timestamp', $data ?? [], null); - $this->setIfExists('endpoint_behavior', $data ?? [], null); - $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); - $this->setIfExists('operation_type', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('property_parser', $data ?? [], null); - $this->setIfExists('time_point', $data ?? [], null); - $this->setIfExists('lower_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('lower_bound_time_point', $data ?? [], null); - $this->setIfExists('upper_bound_endpoint_behavior', $data ?? [], null); - $this->setIfExists('upper_bound_time_point', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; - } - - /** - * 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'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - if ($this->container['set_type'] === null) { - $invalidProperties[] = "'set_type' can't be null"; - } - if ($this->container['comparison'] === null) { - $invalidProperties[] = "'comparison' can't be null"; - } - if ($this->container['time_offset'] === null) { - $invalidProperties[] = "'time_offset' can't be null"; - } - if ($this->container['lower_bound_offset'] === null) { - $invalidProperties[] = "'lower_bound_offset' can't be null"; - } - if ($this->container['range_type'] === null) { - $invalidProperties[] = "'range_type' can't be null"; - } - if ($this->container['upper_bound_offset'] === null) { - $invalidProperties[] = "'upper_bound_offset' can't be null"; - } - if ($this->container['timestamp'] === null) { - $invalidProperties[] = "'timestamp' can't be null"; - } - if ($this->container['lower_timestamp'] === null) { - $invalidProperties[] = "'lower_timestamp' can't be null"; - } - if ($this->container['upper_timestamp'] === null) { - $invalidProperties[] = "'upper_timestamp' can't be null"; - } - if ($this->container['include_objects_with_no_value_set'] === null) { - $invalidProperties[] = "'include_objects_with_no_value_set' can't be null"; - } - if ($this->container['operation_type'] === null) { - $invalidProperties[] = "'operation_type' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['time_point'] === null) { - $invalidProperties[] = "'time_point' can't be null"; - } - if ($this->container['lower_bound_time_point'] === null) { - $invalidProperties[] = "'lower_bound_time_point' can't be null"; - } - if ($this->container['upper_bound_time_point'] === null) { - $invalidProperties[] = "'upper_bound_time_point' 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 max_occurrences - * - * @return int|null - */ - public function getMaxOccurrences() - { - return $this->container['max_occurrences']; - } - - /** - * Sets max_occurrences - * - * @param int|null $max_occurrences The maximum number of occurrences allowed. - * - * @return self - */ - public function setMaxOccurrences($max_occurrences) - { - if (is_null($max_occurrences)) { - throw new \InvalidArgumentException('non-nullable max_occurrences cannot be null'); - } - $this->container['max_occurrences'] = $max_occurrences; - - return $this; - } - - /** - * Gets min_occurrences - * - * @return int|null - */ - public function getMinOccurrences() - { - return $this->container['min_occurrences']; - } - - /** - * Sets min_occurrences - * - * @param int|null $min_occurrences The minimum number of occurrences required. - * - * @return self - */ - public function setMinOccurrences($min_occurrences) - { - if (is_null($min_occurrences)) { - throw new \InvalidArgumentException('non-nullable min_occurrences cannot be null'); - } - $this->container['min_occurrences'] = $min_occurrences; - - return $this; - } - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Defines the type of operation being performed. - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets set_type - * - * @return string - */ - public function getSetType() - { - return $this->container['set_type']; - } - - /** - * Sets set_type - * - * @param string $set_type Indicates the specific set type used in the refinement (ALL, ALL_INCLUDE_EMPTY, ANY, NONE, NONE_EXCLUDE_EMPTY, ANY_INCLUDE_EMPTY). - * - * @return self - */ - public function setSetType($set_type) - { - if (is_null($set_type)) { - throw new \InvalidArgumentException('non-nullable set_type cannot be null'); - } - $this->container['set_type'] = $set_type; - - return $this; - } - - /** - * Gets comparison - * - * @return string - */ - public function getComparison() - { - return $this->container['comparison']; - } - - /** - * Sets comparison - * - * @param string $comparison Timestamp comparison options (BEFORE, AFTER) - * - * @return self - */ - public function setComparison($comparison) - { - if (is_null($comparison)) { - throw new \InvalidArgumentException('non-nullable comparison cannot be null'); - } - $this->container['comparison'] = $comparison; - - return $this; - } - - /** - * Gets time_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getTimeOffset() - { - return $this->container['time_offset']; - } - - /** - * Sets time_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $time_offset time_offset - * - * @return self - */ - public function setTimeOffset($time_offset) - { - if (is_null($time_offset)) { - throw new \InvalidArgumentException('non-nullable time_offset cannot be null'); - } - $this->container['time_offset'] = $time_offset; - - return $this; - } - - /** - * Gets lower_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getLowerBoundOffset() - { - return $this->container['lower_bound_offset']; - } - - /** - * Sets lower_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $lower_bound_offset lower_bound_offset - * - * @return self - */ - public function setLowerBoundOffset($lower_bound_offset) - { - if (is_null($lower_bound_offset)) { - throw new \InvalidArgumentException('non-nullable lower_bound_offset cannot be null'); - } - $this->container['lower_bound_offset'] = $lower_bound_offset; - - return $this; - } - - /** - * Gets range_type - * - * @return string - */ - public function getRangeType() - { - return $this->container['range_type']; - } - - /** - * Sets range_type - * - * @param string $range_type Type of range of refinement critaria (BETWEEN, NOT_BETWEEN) - * - * @return self - */ - public function setRangeType($range_type) - { - if (is_null($range_type)) { - throw new \InvalidArgumentException('non-nullable range_type cannot be null'); - } - $this->container['range_type'] = $range_type; - - return $this; - } - - /** - * Gets upper_bound_offset - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset - */ - public function getUpperBoundOffset() - { - return $this->container['upper_bound_offset']; - } - - /** - * Sets upper_bound_offset - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimeOffset $upper_bound_offset upper_bound_offset - * - * @return self - */ - public function setUpperBoundOffset($upper_bound_offset) - { - if (is_null($upper_bound_offset)) { - throw new \InvalidArgumentException('non-nullable upper_bound_offset cannot be null'); - } - $this->container['upper_bound_offset'] = $upper_bound_offset; - - return $this; - } - - /** - * Gets timestamp - * - * @return int - */ - public function getTimestamp() - { - return $this->container['timestamp']; - } - - /** - * Sets timestamp - * - * @param int $timestamp Timestamp to be used in refine by criteria - * - * @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 lower_timestamp - * - * @return int - */ - public function getLowerTimestamp() - { - return $this->container['lower_timestamp']; - } - - /** - * Sets lower_timestamp - * - * @param int $lower_timestamp Lower range timestamp of refinement criteria - * - * @return self - */ - public function setLowerTimestamp($lower_timestamp) - { - if (is_null($lower_timestamp)) { - throw new \InvalidArgumentException('non-nullable lower_timestamp cannot be null'); - } - $this->container['lower_timestamp'] = $lower_timestamp; - - return $this; - } - - /** - * Gets upper_timestamp - * - * @return int - */ - public function getUpperTimestamp() - { - return $this->container['upper_timestamp']; - } - - /** - * Sets upper_timestamp - * - * @param int $upper_timestamp Upper range timestamp of refinement criteria - * - * @return self - */ - public function setUpperTimestamp($upper_timestamp) - { - if (is_null($upper_timestamp)) { - throw new \InvalidArgumentException('non-nullable upper_timestamp cannot be null'); - } - $this->container['upper_timestamp'] = $upper_timestamp; - - return $this; - } - - /** - * Gets endpoint_behavior - * - * @return string|null - */ - public function getEndpointBehavior() - { - return $this->container['endpoint_behavior']; - } - - /** - * Sets endpoint_behavior - * - * @param string|null $endpoint_behavior Describes the behavior at the endpoint of the time point operation. - * - * @return self - */ - public function setEndpointBehavior($endpoint_behavior) - { - if (is_null($endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable endpoint_behavior cannot be null'); - } - $this->container['endpoint_behavior'] = $endpoint_behavior; - - return $this; - } - - /** - * Gets include_objects_with_no_value_set - * - * @return bool - */ - public function getIncludeObjectsWithNoValueSet() - { - return $this->container['include_objects_with_no_value_set']; - } - - /** - * Sets include_objects_with_no_value_set - * - * @param bool $include_objects_with_no_value_set Indicates whether objects with no value set for the property should be included in the operation. - * - * @return self - */ - public function setIncludeObjectsWithNoValueSet($include_objects_with_no_value_set) - { - if (is_null($include_objects_with_no_value_set)) { - throw new \InvalidArgumentException('non-nullable include_objects_with_no_value_set cannot be null'); - } - $this->container['include_objects_with_no_value_set'] = $include_objects_with_no_value_set; - - return $this; - } - - /** - * Gets operation_type - * - * @return string - */ - public function getOperationType() - { - return $this->container['operation_type']; - } - - /** - * Sets operation_type - * - * @param string $operation_type Specifies the type of operation (TIME_RANGED). - * - * @return self - */ - public function setOperationType($operation_type) - { - if (is_null($operation_type)) { - throw new \InvalidArgumentException('non-nullable operation_type cannot be null'); - } - $this->container['operation_type'] = $operation_type; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied within the time range (IS_BETWEEN, IS_NOT_BETWEEN). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets property_parser - * - * @return string|null - */ - public function getPropertyParser() - { - return $this->container['property_parser']; - } - - /** - * Sets property_parser - * - * @param string|null $property_parser Specifies the parser used for the property in the operation. - * - * @return self - */ - public function setPropertyParser($property_parser) - { - if (is_null($property_parser)) { - throw new \InvalidArgumentException('non-nullable property_parser cannot be null'); - } - $this->container['property_parser'] = $property_parser; - - return $this; - } - - /** - * Gets time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint - */ - public function getTimePoint() - { - return $this->container['time_point']; - } - - /** - * Sets time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicTimePointOperationTimePoint $time_point time_point - * - * @return self - */ - public function setTimePoint($time_point) - { - if (is_null($time_point)) { - throw new \InvalidArgumentException('non-nullable time_point cannot be null'); - } - $this->container['time_point'] = $time_point; - - return $this; - } - - /** - * Gets lower_bound_endpoint_behavior - * - * @return string|null - */ - public function getLowerBoundEndpointBehavior() - { - return $this->container['lower_bound_endpoint_behavior']; - } - - /** - * Sets lower_bound_endpoint_behavior - * - * @param string|null $lower_bound_endpoint_behavior Describes the behavior at the lower bound endpoint of the time range. - * - * @return self - */ - public function setLowerBoundEndpointBehavior($lower_bound_endpoint_behavior) - { - if (is_null($lower_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable lower_bound_endpoint_behavior cannot be null'); - } - $this->container['lower_bound_endpoint_behavior'] = $lower_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets lower_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint - */ - public function getLowerBoundTimePoint() - { - return $this->container['lower_bound_time_point']; - } - - /** - * Sets lower_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationLowerBoundTimePoint $lower_bound_time_point lower_bound_time_point - * - * @return self - */ - public function setLowerBoundTimePoint($lower_bound_time_point) - { - if (is_null($lower_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable lower_bound_time_point cannot be null'); - } - $this->container['lower_bound_time_point'] = $lower_bound_time_point; - - return $this; - } - - /** - * Gets upper_bound_endpoint_behavior - * - * @return string|null - */ - public function getUpperBoundEndpointBehavior() - { - return $this->container['upper_bound_endpoint_behavior']; - } - - /** - * Sets upper_bound_endpoint_behavior - * - * @param string|null $upper_bound_endpoint_behavior Describes the behavior at the upper bound endpoint of the time range. - * - * @return self - */ - public function setUpperBoundEndpointBehavior($upper_bound_endpoint_behavior) - { - if (is_null($upper_bound_endpoint_behavior)) { - throw new \InvalidArgumentException('non-nullable upper_bound_endpoint_behavior cannot be null'); - } - $this->container['upper_bound_endpoint_behavior'] = $upper_bound_endpoint_behavior; - - return $this; - } - - /** - * Gets upper_bound_time_point - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint - */ - public function getUpperBoundTimePoint() - { - return $this->container['upper_bound_time_point']; - } - - /** - * Sets upper_bound_time_point - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicRangedTimeOperationUpperBoundTimePoint $upper_bound_time_point upper_bound_time_point - * - * @return self - */ - public function setUpperBoundTimePoint($upper_bound_time_point) - { - if (is_null($upper_bound_time_point)) { - throw new \InvalidArgumentException('non-nullable upper_bound_time_point cannot be null'); - } - $this->container['upper_bound_time_point'] = $upper_bound_time_point; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicPropertyAssociationFilterBranch.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php deleted file mode 100644 index 3c9e6d4f..00000000 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php +++ /dev/null @@ -1,666 +0,0 @@ - - */ -class PublicPropertyAssociationFilterBranch implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicPropertyAssociationFilterBranch'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'filter_branch_operator' => 'string', - 'filter_branch_type' => 'string', - 'filter_branches' => '\HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[]', - 'filters' => '\HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[]', - 'object_type_id' => 'string', - 'operator' => 'string', - 'property_with_object_id' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'filter_branch_operator' => null, - 'filter_branch_type' => null, - 'filter_branches' => null, - 'filters' => null, - 'object_type_id' => null, - 'operator' => null, - 'property_with_object_id' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'filter_branch_operator' => false, - 'filter_branch_type' => false, - 'filter_branches' => false, - 'filters' => false, - 'object_type_id' => false, - 'operator' => false, - 'property_with_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 = [ - 'filter_branch_operator' => 'filterBranchOperator', - 'filter_branch_type' => 'filterBranchType', - 'filter_branches' => 'filterBranches', - 'filters' => 'filters', - 'object_type_id' => 'objectTypeId', - 'operator' => 'operator', - 'property_with_object_id' => 'propertyWithObjectId' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'filter_branch_operator' => 'setFilterBranchOperator', - 'filter_branch_type' => 'setFilterBranchType', - 'filter_branches' => 'setFilterBranches', - 'filters' => 'setFilters', - 'object_type_id' => 'setObjectTypeId', - 'operator' => 'setOperator', - 'property_with_object_id' => 'setPropertyWithObjectId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'filter_branch_operator' => 'getFilterBranchOperator', - 'filter_branch_type' => 'getFilterBranchType', - 'filter_branches' => 'getFilterBranches', - 'filters' => 'getFilters', - 'object_type_id' => 'getObjectTypeId', - 'operator' => 'getOperator', - 'property_with_object_id' => 'getPropertyWithObjectId' - ]; - - /** - * 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 FILTER_BRANCH_TYPE_PROPERTY_ASSOCIATION = 'PROPERTY_ASSOCIATION'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterBranchTypeAllowableValues() - { - return [ - self::FILTER_BRANCH_TYPE_PROPERTY_ASSOCIATION, - ]; - } - - /** - * 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('filter_branch_operator', $data ?? [], null); - $this->setIfExists('filter_branch_type', $data ?? [], 'PROPERTY_ASSOCIATION'); - $this->setIfExists('filter_branches', $data ?? [], null); - $this->setIfExists('filters', $data ?? [], null); - $this->setIfExists('object_type_id', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('property_with_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['filter_branch_operator'] === null) { - $invalidProperties[] = "'filter_branch_operator' can't be null"; - } - if ($this->container['filter_branch_type'] === null) { - $invalidProperties[] = "'filter_branch_type' can't be null"; - } - $allowedValues = $this->getFilterBranchTypeAllowableValues(); - if (!is_null($this->container['filter_branch_type']) && !in_array($this->container['filter_branch_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_branch_type', must be one of '%s'", - $this->container['filter_branch_type'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['filter_branches'] === null) { - $invalidProperties[] = "'filter_branches' can't be null"; - } - if ($this->container['filters'] === null) { - $invalidProperties[] = "'filters' can't be null"; - } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['property_with_object_id'] === null) { - $invalidProperties[] = "'property_with_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 filter_branch_operator - * - * @return string - */ - public function getFilterBranchOperator() - { - return $this->container['filter_branch_operator']; - } - - /** - * Sets filter_branch_operator - * - * @param string $filter_branch_operator The logical operator used to combine filters within the branch. - * - * @return self - */ - public function setFilterBranchOperator($filter_branch_operator) - { - if (is_null($filter_branch_operator)) { - throw new \InvalidArgumentException('non-nullable filter_branch_operator cannot be null'); - } - $this->container['filter_branch_operator'] = $filter_branch_operator; - - return $this; - } - - /** - * Gets filter_branch_type - * - * @return string - */ - public function getFilterBranchType() - { - return $this->container['filter_branch_type']; - } - - /** - * Sets filter_branch_type - * - * @param string $filter_branch_type The type of the filter branch (PROPERTY_ASSOCIATION). - * - * @return self - */ - public function setFilterBranchType($filter_branch_type) - { - if (is_null($filter_branch_type)) { - throw new \InvalidArgumentException('non-nullable filter_branch_type cannot be null'); - } - $allowedValues = $this->getFilterBranchTypeAllowableValues(); - if (!in_array($filter_branch_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_branch_type', must be one of '%s'", - $filter_branch_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_branch_type'] = $filter_branch_type; - - return $this; - } - - /** - * Gets filter_branches - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[] - */ - public function getFilterBranches() - { - return $this->container['filter_branches']; - } - - /** - * Sets filter_branches - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[] $filter_branches filter_branches - * - * @return self - */ - public function setFilterBranches($filter_branches) - { - if (is_null($filter_branches)) { - throw new \InvalidArgumentException('non-nullable filter_branches cannot be null'); - } - $this->container['filter_branches'] = $filter_branches; - - return $this; - } - - /** - * Gets filters - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[] - */ - public function getFilters() - { - return $this->container['filters']; - } - - /** - * Sets filters - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[] $filters filters - * - * @return self - */ - public function setFilters($filters) - { - if (is_null($filters)) { - throw new \InvalidArgumentException('non-nullable filters cannot be null'); - } - $this->container['filters'] = $filters; - - return $this; - } - - /** - * Gets object_type_id - * - * @return string - */ - public function getObjectTypeId() - { - return $this->container['object_type_id']; - } - - /** - * Sets object_type_id - * - * @param string $object_type_id The ID representing the type of object associated with the filter branch. - * - * @return self - */ - public function setObjectTypeId($object_type_id) - { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); - } - $this->container['object_type_id'] = $object_type_id; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied within the filter branch (IN_LIST, NOT_IN_LIST). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets property_with_object_id - * - * @return string - */ - public function getPropertyWithObjectId() - { - return $this->container['property_with_object_id']; - } - - /** - * Sets property_with_object_id - * - * @param string $property_with_object_id The property that is associated with the object ID in the filter branch. - * - * @return self - */ - public function setPropertyWithObjectId($property_with_object_id) - { - if (is_null($property_with_object_id)) { - throw new \InvalidArgumentException('non-nullable property_with_object_id cannot be null'); - } - $this->container['property_with_object_id'] = $property_with_object_id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php deleted file mode 100644 index 4c120e93..00000000 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php +++ /dev/null @@ -1,814 +0,0 @@ - - */ -class PublicPropertyAssociationFilterBranchFilterBranchesInner implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'filter_branch_type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicPropertyAssociationFilterBranch_filterBranches_inner'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'filter_branch_operator' => 'string', - 'filter_branch_type' => 'string', - 'filter_branches' => '\HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[]', - 'filters' => '\HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[]', - 'coalescing_refine_by' => '\HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy', - 'event_type_id' => 'string', - 'operator' => 'string', - 'object_type_id' => 'string', - 'property_with_object_id' => 'string', - '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 = [ - 'filter_branch_operator' => null, - 'filter_branch_type' => null, - 'filter_branches' => null, - 'filters' => null, - 'coalescing_refine_by' => null, - 'event_type_id' => null, - 'operator' => null, - 'object_type_id' => null, - 'property_with_object_id' => null, - 'association_category' => null, - 'association_type_id' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'filter_branch_operator' => false, - 'filter_branch_type' => false, - 'filter_branches' => false, - 'filters' => false, - 'coalescing_refine_by' => false, - 'event_type_id' => false, - 'operator' => false, - 'object_type_id' => false, - 'property_with_object_id' => false, - '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 = [ - 'filter_branch_operator' => 'filterBranchOperator', - 'filter_branch_type' => 'filterBranchType', - 'filter_branches' => 'filterBranches', - 'filters' => 'filters', - 'coalescing_refine_by' => 'coalescingRefineBy', - 'event_type_id' => 'eventTypeId', - 'operator' => 'operator', - 'object_type_id' => 'objectTypeId', - 'property_with_object_id' => 'propertyWithObjectId', - 'association_category' => 'associationCategory', - 'association_type_id' => 'associationTypeId' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'filter_branch_operator' => 'setFilterBranchOperator', - 'filter_branch_type' => 'setFilterBranchType', - 'filter_branches' => 'setFilterBranches', - 'filters' => 'setFilters', - 'coalescing_refine_by' => 'setCoalescingRefineBy', - 'event_type_id' => 'setEventTypeId', - 'operator' => 'setOperator', - 'object_type_id' => 'setObjectTypeId', - 'property_with_object_id' => 'setPropertyWithObjectId', - 'association_category' => 'setAssociationCategory', - 'association_type_id' => 'setAssociationTypeId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'filter_branch_operator' => 'getFilterBranchOperator', - 'filter_branch_type' => 'getFilterBranchType', - 'filter_branches' => 'getFilterBranches', - 'filters' => 'getFilters', - 'coalescing_refine_by' => 'getCoalescingRefineBy', - 'event_type_id' => 'getEventTypeId', - 'operator' => 'getOperator', - 'object_type_id' => 'getObjectTypeId', - 'property_with_object_id' => 'getPropertyWithObjectId', - '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 FILTER_BRANCH_TYPE_ASSOCIATION = 'ASSOCIATION'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterBranchTypeAllowableValues() - { - return [ - self::FILTER_BRANCH_TYPE_ASSOCIATION, - ]; - } - - /** - * 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('filter_branch_operator', $data ?? [], null); - $this->setIfExists('filter_branch_type', $data ?? [], 'ASSOCIATION'); - $this->setIfExists('filter_branches', $data ?? [], null); - $this->setIfExists('filters', $data ?? [], null); - $this->setIfExists('coalescing_refine_by', $data ?? [], null); - $this->setIfExists('event_type_id', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('object_type_id', $data ?? [], null); - $this->setIfExists('property_with_object_id', $data ?? [], null); - $this->setIfExists('association_category', $data ?? [], null); - $this->setIfExists('association_type_id', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['filter_branch_type'] = static::$openAPIModelName; - } - - /** - * 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['filter_branch_operator'] === null) { - $invalidProperties[] = "'filter_branch_operator' can't be null"; - } - if ($this->container['filter_branch_type'] === null) { - $invalidProperties[] = "'filter_branch_type' can't be null"; - } - $allowedValues = $this->getFilterBranchTypeAllowableValues(); - if (!is_null($this->container['filter_branch_type']) && !in_array($this->container['filter_branch_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_branch_type', must be one of '%s'", - $this->container['filter_branch_type'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['filter_branches'] === null) { - $invalidProperties[] = "'filter_branches' can't be null"; - } - if ($this->container['filters'] === null) { - $invalidProperties[] = "'filters' can't be null"; - } - if ($this->container['event_type_id'] === null) { - $invalidProperties[] = "'event_type_id' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['property_with_object_id'] === null) { - $invalidProperties[] = "'property_with_object_id' can't be null"; - } - if ($this->container['association_category'] === null) { - $invalidProperties[] = "'association_category' can't be null"; - } - 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 filter_branch_operator - * - * @return string - */ - public function getFilterBranchOperator() - { - return $this->container['filter_branch_operator']; - } - - /** - * Sets filter_branch_operator - * - * @param string $filter_branch_operator Filter branch operator (AND) - * - * @return self - */ - public function setFilterBranchOperator($filter_branch_operator) - { - if (is_null($filter_branch_operator)) { - throw new \InvalidArgumentException('non-nullable filter_branch_operator cannot be null'); - } - $this->container['filter_branch_operator'] = $filter_branch_operator; - - return $this; - } - - /** - * Gets filter_branch_type - * - * @return string - */ - public function getFilterBranchType() - { - return $this->container['filter_branch_type']; - } - - /** - * Sets filter_branch_type - * - * @param string $filter_branch_type Type of the filter branch (ASSOCIATION) - * - * @return self - */ - public function setFilterBranchType($filter_branch_type) - { - if (is_null($filter_branch_type)) { - throw new \InvalidArgumentException('non-nullable filter_branch_type cannot be null'); - } - $allowedValues = $this->getFilterBranchTypeAllowableValues(); - if (!in_array($filter_branch_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_branch_type', must be one of '%s'", - $filter_branch_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_branch_type'] = $filter_branch_type; - - return $this; - } - - /** - * Gets filter_branches - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[] - */ - public function getFilterBranches() - { - return $this->container['filter_branches']; - } - - /** - * Sets filter_branches - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFilterBranchesInner[] $filter_branches filter_branches - * - * @return self - */ - public function setFilterBranches($filter_branches) - { - if (is_null($filter_branches)) { - throw new \InvalidArgumentException('non-nullable filter_branches cannot be null'); - } - $this->container['filter_branches'] = $filter_branches; - - return $this; - } - - /** - * Gets filters - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[] - */ - public function getFilters() - { - return $this->container['filters']; - } - - /** - * Sets filters - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicPropertyAssociationFilterBranchFiltersInner[] $filters filters - * - * @return self - */ - public function setFilters($filters) - { - if (is_null($filters)) { - throw new \InvalidArgumentException('non-nullable filters cannot be null'); - } - $this->container['filters'] = $filters; - - return $this; - } - - /** - * Gets coalescing_refine_by - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy|null - */ - public function getCoalescingRefineBy() - { - return $this->container['coalescing_refine_by']; - } - - /** - * Sets coalescing_refine_by - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy|null $coalescing_refine_by coalescing_refine_by - * - * @return self - */ - public function setCoalescingRefineBy($coalescing_refine_by) - { - if (is_null($coalescing_refine_by)) { - throw new \InvalidArgumentException('non-nullable coalescing_refine_by cannot be null'); - } - $this->container['coalescing_refine_by'] = $coalescing_refine_by; - - return $this; - } - - /** - * Gets event_type_id - * - * @return string - */ - public function getEventTypeId() - { - return $this->container['event_type_id']; - } - - /** - * Sets event_type_id - * - * @param string $event_type_id The identifier for the type of event associated with the filter branch. - * - * @return self - */ - public function setEventTypeId($event_type_id) - { - if (is_null($event_type_id)) { - throw new \InvalidArgumentException('non-nullable event_type_id cannot be null'); - } - $this->container['event_type_id'] = $event_type_id; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied within the filter branch (IN_LIST, NOT_IN_LIST). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets object_type_id - * - * @return string - */ - public function getObjectTypeId() - { - return $this->container['object_type_id']; - } - - /** - * Sets object_type_id - * - * @param string $object_type_id The ID representing the type of object associated with the filter branch. - * - * @return self - */ - public function setObjectTypeId($object_type_id) - { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); - } - $this->container['object_type_id'] = $object_type_id; - - return $this; - } - - /** - * Gets property_with_object_id - * - * @return string - */ - public function getPropertyWithObjectId() - { - return $this->container['property_with_object_id']; - } - - /** - * Sets property_with_object_id - * - * @param string $property_with_object_id The property that is associated with the object ID in the filter branch. - * - * @return self - */ - public function setPropertyWithObjectId($property_with_object_id) - { - if (is_null($property_with_object_id)) { - throw new \InvalidArgumentException('non-nullable property_with_object_id cannot be null'); - } - $this->container['property_with_object_id'] = $property_with_object_id; - - return $this; - } - - /** - * Gets association_category - * - * @return string - */ - public function getAssociationCategory() - { - return $this->container['association_category']; - } - - /** - * Sets association_category - * - * @param string $association_category Specifies the category of the association for the filter branch (HUBSPOT_DEFINED, USER_DEFINED, INTEGRATOR_DEFINED, WORK). - * - * @return self - */ - public function setAssociationCategory($association_category) - { - if (is_null($association_category)) { - throw new \InvalidArgumentException('non-nullable association_category cannot be null'); - } - $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 Type id of the association - * - * @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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php deleted file mode 100644 index e93fecc8..00000000 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php +++ /dev/null @@ -1,2042 +0,0 @@ - - */ -class PublicPropertyAssociationFilterBranchFiltersInner implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'filter_type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicPropertyAssociationFilterBranch_filters_inner'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'filter_type' => 'string', - 'operation' => '\HubSpot\Client\Crm\Lists\Model\PublicPropertyFilterOperation', - 'property' => 'string', - 'association_category' => 'string', - 'association_type_id' => 'int', - 'coalescing_refine_by' => '\HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy', - 'list_id' => 'string', - 'operator' => 'string', - 'to_object_type' => 'string', - 'to_object_type_id' => 'string', - 'enable_tracking' => 'bool', - 'page_url' => 'string', - 'pruning_refine_by' => '\HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterPruningRefineBy', - 'cta_name' => 'string', - 'event_id' => 'string', - 'form_id' => 'string', - 'page_id' => 'string', - 'event_type_id' => 'string', - 'filter_lines' => '\HubSpot\Client\Crm\Lists\Model\PublicEventFilterMetadata[]', - 'accepted_statuses' => 'string[]', - 'subscription_ids' => 'string[]', - 'subscription_type' => 'string', - 'accepted_opt_states' => 'string[]', - 'business_unit_id' => 'string', - 'channel' => 'string', - 'campaign_id' => 'string', - 'survey_id' => 'string', - 'survey_answer_col_id' => 'string', - 'survey_answer_row_id' => 'string', - 'survey_question' => 'string', - 'value_comparison' => '\HubSpot\Client\Crm\Lists\Model\PublicSurveyMonkeyValueFilterValueComparison', - 'webinar_id' => 'string', - 'app_id' => 'string', - 'click_url' => 'string', - 'email_id' => 'string', - 'level' => 'string', - 'privacy_name' => 'string', - 'ad_network' => 'string', - 'entity_type' => 'string', - 'search_term_type' => 'string', - 'search_terms' => 'string[]', - 'metadata' => '\HubSpot\Client\Crm\Lists\Model\PublicInListFilterMetadata', - 'property_with_object_id' => 'string', - 'should_accept' => 'bool', - 'source' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'filter_type' => null, - 'operation' => null, - 'property' => null, - 'association_category' => null, - 'association_type_id' => 'int32', - 'coalescing_refine_by' => null, - 'list_id' => null, - 'operator' => null, - 'to_object_type' => null, - 'to_object_type_id' => null, - 'enable_tracking' => null, - 'page_url' => null, - 'pruning_refine_by' => null, - 'cta_name' => null, - 'event_id' => null, - 'form_id' => null, - 'page_id' => null, - 'event_type_id' => null, - 'filter_lines' => null, - 'accepted_statuses' => null, - 'subscription_ids' => null, - 'subscription_type' => null, - 'accepted_opt_states' => null, - 'business_unit_id' => null, - 'channel' => null, - 'campaign_id' => null, - 'survey_id' => null, - 'survey_answer_col_id' => null, - 'survey_answer_row_id' => null, - 'survey_question' => null, - 'value_comparison' => null, - 'webinar_id' => null, - 'app_id' => null, - 'click_url' => null, - 'email_id' => null, - 'level' => null, - 'privacy_name' => null, - 'ad_network' => null, - 'entity_type' => null, - 'search_term_type' => null, - 'search_terms' => null, - 'metadata' => null, - 'property_with_object_id' => null, - 'should_accept' => null, - 'source' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'filter_type' => false, - 'operation' => false, - 'property' => false, - 'association_category' => false, - 'association_type_id' => false, - 'coalescing_refine_by' => false, - 'list_id' => false, - 'operator' => false, - 'to_object_type' => false, - 'to_object_type_id' => false, - 'enable_tracking' => false, - 'page_url' => false, - 'pruning_refine_by' => false, - 'cta_name' => false, - 'event_id' => false, - 'form_id' => false, - 'page_id' => false, - 'event_type_id' => false, - 'filter_lines' => false, - 'accepted_statuses' => false, - 'subscription_ids' => false, - 'subscription_type' => false, - 'accepted_opt_states' => false, - 'business_unit_id' => false, - 'channel' => false, - 'campaign_id' => false, - 'survey_id' => false, - 'survey_answer_col_id' => false, - 'survey_answer_row_id' => false, - 'survey_question' => false, - 'value_comparison' => false, - 'webinar_id' => false, - 'app_id' => false, - 'click_url' => false, - 'email_id' => false, - 'level' => false, - 'privacy_name' => false, - 'ad_network' => false, - 'entity_type' => false, - 'search_term_type' => false, - 'search_terms' => false, - 'metadata' => false, - 'property_with_object_id' => false, - 'should_accept' => false, - 'source' => 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 = [ - 'filter_type' => 'filterType', - 'operation' => 'operation', - 'property' => 'property', - 'association_category' => 'associationCategory', - 'association_type_id' => 'associationTypeId', - 'coalescing_refine_by' => 'coalescingRefineBy', - 'list_id' => 'listId', - 'operator' => 'operator', - 'to_object_type' => 'toObjectType', - 'to_object_type_id' => 'toObjectTypeId', - 'enable_tracking' => 'enableTracking', - 'page_url' => 'pageUrl', - 'pruning_refine_by' => 'pruningRefineBy', - 'cta_name' => 'ctaName', - 'event_id' => 'eventId', - 'form_id' => 'formId', - 'page_id' => 'pageId', - 'event_type_id' => 'eventTypeId', - 'filter_lines' => 'filterLines', - 'accepted_statuses' => 'acceptedStatuses', - 'subscription_ids' => 'subscriptionIds', - 'subscription_type' => 'subscriptionType', - 'accepted_opt_states' => 'acceptedOptStates', - 'business_unit_id' => 'businessUnitId', - 'channel' => 'channel', - 'campaign_id' => 'campaignId', - 'survey_id' => 'surveyId', - 'survey_answer_col_id' => 'surveyAnswerColId', - 'survey_answer_row_id' => 'surveyAnswerRowId', - 'survey_question' => 'surveyQuestion', - 'value_comparison' => 'valueComparison', - 'webinar_id' => 'webinarId', - 'app_id' => 'appId', - 'click_url' => 'clickUrl', - 'email_id' => 'emailId', - 'level' => 'level', - 'privacy_name' => 'privacyName', - 'ad_network' => 'adNetwork', - 'entity_type' => 'entityType', - 'search_term_type' => 'searchTermType', - 'search_terms' => 'searchTerms', - 'metadata' => 'metadata', - 'property_with_object_id' => 'propertyWithObjectId', - 'should_accept' => 'shouldAccept', - 'source' => 'source' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'filter_type' => 'setFilterType', - 'operation' => 'setOperation', - 'property' => 'setProperty', - 'association_category' => 'setAssociationCategory', - 'association_type_id' => 'setAssociationTypeId', - 'coalescing_refine_by' => 'setCoalescingRefineBy', - 'list_id' => 'setListId', - 'operator' => 'setOperator', - 'to_object_type' => 'setToObjectType', - 'to_object_type_id' => 'setToObjectTypeId', - 'enable_tracking' => 'setEnableTracking', - 'page_url' => 'setPageUrl', - 'pruning_refine_by' => 'setPruningRefineBy', - 'cta_name' => 'setCtaName', - 'event_id' => 'setEventId', - 'form_id' => 'setFormId', - 'page_id' => 'setPageId', - 'event_type_id' => 'setEventTypeId', - 'filter_lines' => 'setFilterLines', - 'accepted_statuses' => 'setAcceptedStatuses', - 'subscription_ids' => 'setSubscriptionIds', - 'subscription_type' => 'setSubscriptionType', - 'accepted_opt_states' => 'setAcceptedOptStates', - 'business_unit_id' => 'setBusinessUnitId', - 'channel' => 'setChannel', - 'campaign_id' => 'setCampaignId', - 'survey_id' => 'setSurveyId', - 'survey_answer_col_id' => 'setSurveyAnswerColId', - 'survey_answer_row_id' => 'setSurveyAnswerRowId', - 'survey_question' => 'setSurveyQuestion', - 'value_comparison' => 'setValueComparison', - 'webinar_id' => 'setWebinarId', - 'app_id' => 'setAppId', - 'click_url' => 'setClickUrl', - 'email_id' => 'setEmailId', - 'level' => 'setLevel', - 'privacy_name' => 'setPrivacyName', - 'ad_network' => 'setAdNetwork', - 'entity_type' => 'setEntityType', - 'search_term_type' => 'setSearchTermType', - 'search_terms' => 'setSearchTerms', - 'metadata' => 'setMetadata', - 'property_with_object_id' => 'setPropertyWithObjectId', - 'should_accept' => 'setShouldAccept', - 'source' => 'setSource' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'filter_type' => 'getFilterType', - 'operation' => 'getOperation', - 'property' => 'getProperty', - 'association_category' => 'getAssociationCategory', - 'association_type_id' => 'getAssociationTypeId', - 'coalescing_refine_by' => 'getCoalescingRefineBy', - 'list_id' => 'getListId', - 'operator' => 'getOperator', - 'to_object_type' => 'getToObjectType', - 'to_object_type_id' => 'getToObjectTypeId', - 'enable_tracking' => 'getEnableTracking', - 'page_url' => 'getPageUrl', - 'pruning_refine_by' => 'getPruningRefineBy', - 'cta_name' => 'getCtaName', - 'event_id' => 'getEventId', - 'form_id' => 'getFormId', - 'page_id' => 'getPageId', - 'event_type_id' => 'getEventTypeId', - 'filter_lines' => 'getFilterLines', - 'accepted_statuses' => 'getAcceptedStatuses', - 'subscription_ids' => 'getSubscriptionIds', - 'subscription_type' => 'getSubscriptionType', - 'accepted_opt_states' => 'getAcceptedOptStates', - 'business_unit_id' => 'getBusinessUnitId', - 'channel' => 'getChannel', - 'campaign_id' => 'getCampaignId', - 'survey_id' => 'getSurveyId', - 'survey_answer_col_id' => 'getSurveyAnswerColId', - 'survey_answer_row_id' => 'getSurveyAnswerRowId', - 'survey_question' => 'getSurveyQuestion', - 'value_comparison' => 'getValueComparison', - 'webinar_id' => 'getWebinarId', - 'app_id' => 'getAppId', - 'click_url' => 'getClickUrl', - 'email_id' => 'getEmailId', - 'level' => 'getLevel', - 'privacy_name' => 'getPrivacyName', - 'ad_network' => 'getAdNetwork', - 'entity_type' => 'getEntityType', - 'search_term_type' => 'getSearchTermType', - 'search_terms' => 'getSearchTerms', - 'metadata' => 'getMetadata', - 'property_with_object_id' => 'getPropertyWithObjectId', - 'should_accept' => 'getShouldAccept', - 'source' => 'getSource' - ]; - - /** - * 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 FILTER_TYPE_CONSTANT = 'CONSTANT'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterTypeAllowableValues() - { - return [ - self::FILTER_TYPE_CONSTANT, - ]; - } - - /** - * 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('filter_type', $data ?? [], 'CONSTANT'); - $this->setIfExists('operation', $data ?? [], null); - $this->setIfExists('property', $data ?? [], null); - $this->setIfExists('association_category', $data ?? [], null); - $this->setIfExists('association_type_id', $data ?? [], null); - $this->setIfExists('coalescing_refine_by', $data ?? [], null); - $this->setIfExists('list_id', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('to_object_type', $data ?? [], null); - $this->setIfExists('to_object_type_id', $data ?? [], null); - $this->setIfExists('enable_tracking', $data ?? [], null); - $this->setIfExists('page_url', $data ?? [], null); - $this->setIfExists('pruning_refine_by', $data ?? [], null); - $this->setIfExists('cta_name', $data ?? [], null); - $this->setIfExists('event_id', $data ?? [], null); - $this->setIfExists('form_id', $data ?? [], null); - $this->setIfExists('page_id', $data ?? [], null); - $this->setIfExists('event_type_id', $data ?? [], null); - $this->setIfExists('filter_lines', $data ?? [], null); - $this->setIfExists('accepted_statuses', $data ?? [], null); - $this->setIfExists('subscription_ids', $data ?? [], null); - $this->setIfExists('subscription_type', $data ?? [], null); - $this->setIfExists('accepted_opt_states', $data ?? [], null); - $this->setIfExists('business_unit_id', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], null); - $this->setIfExists('campaign_id', $data ?? [], null); - $this->setIfExists('survey_id', $data ?? [], null); - $this->setIfExists('survey_answer_col_id', $data ?? [], null); - $this->setIfExists('survey_answer_row_id', $data ?? [], null); - $this->setIfExists('survey_question', $data ?? [], null); - $this->setIfExists('value_comparison', $data ?? [], null); - $this->setIfExists('webinar_id', $data ?? [], null); - $this->setIfExists('app_id', $data ?? [], null); - $this->setIfExists('click_url', $data ?? [], null); - $this->setIfExists('email_id', $data ?? [], null); - $this->setIfExists('level', $data ?? [], null); - $this->setIfExists('privacy_name', $data ?? [], null); - $this->setIfExists('ad_network', $data ?? [], null); - $this->setIfExists('entity_type', $data ?? [], null); - $this->setIfExists('search_term_type', $data ?? [], null); - $this->setIfExists('search_terms', $data ?? [], null); - $this->setIfExists('metadata', $data ?? [], null); - $this->setIfExists('property_with_object_id', $data ?? [], null); - $this->setIfExists('should_accept', $data ?? [], null); - $this->setIfExists('source', $data ?? [], null); - - // Initialize discriminator property with the model name. - $this->container['filter_type'] = static::$openAPIModelName; - } - - /** - * 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['filter_type'] === null) { - $invalidProperties[] = "'filter_type' can't be null"; - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_type', must be one of '%s'", - $this->container['filter_type'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['operation'] === null) { - $invalidProperties[] = "'operation' can't be null"; - } - if ($this->container['property'] === null) { - $invalidProperties[] = "'property' can't be null"; - } - if ($this->container['association_category'] === null) { - $invalidProperties[] = "'association_category' can't be null"; - } - if ($this->container['association_type_id'] === null) { - $invalidProperties[] = "'association_type_id' can't be null"; - } - if ($this->container['coalescing_refine_by'] === null) { - $invalidProperties[] = "'coalescing_refine_by' can't be null"; - } - if ($this->container['list_id'] === null) { - $invalidProperties[] = "'list_id' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['page_url'] === null) { - $invalidProperties[] = "'page_url' can't be null"; - } - if ($this->container['pruning_refine_by'] === null) { - $invalidProperties[] = "'pruning_refine_by' can't be null"; - } - if ($this->container['cta_name'] === null) { - $invalidProperties[] = "'cta_name' can't be null"; - } - if ($this->container['event_id'] === null) { - $invalidProperties[] = "'event_id' can't be null"; - } - if ($this->container['page_id'] === null) { - $invalidProperties[] = "'page_id' can't be null"; - } - if ($this->container['event_type_id'] === null) { - $invalidProperties[] = "'event_type_id' can't be null"; - } - if ($this->container['filter_lines'] === null) { - $invalidProperties[] = "'filter_lines' can't be null"; - } - if ($this->container['accepted_statuses'] === null) { - $invalidProperties[] = "'accepted_statuses' can't be null"; - } - if ($this->container['subscription_ids'] === null) { - $invalidProperties[] = "'subscription_ids' can't be null"; - } - if ($this->container['subscription_type'] === null) { - $invalidProperties[] = "'subscription_type' can't be null"; - } - if ($this->container['accepted_opt_states'] === null) { - $invalidProperties[] = "'accepted_opt_states' can't be null"; - } - if ($this->container['channel'] === null) { - $invalidProperties[] = "'channel' can't be null"; - } - if ($this->container['campaign_id'] === null) { - $invalidProperties[] = "'campaign_id' can't be null"; - } - if ($this->container['survey_id'] === null) { - $invalidProperties[] = "'survey_id' can't be null"; - } - if ($this->container['survey_question'] === null) { - $invalidProperties[] = "'survey_question' can't be null"; - } - if ($this->container['value_comparison'] === null) { - $invalidProperties[] = "'value_comparison' can't be null"; - } - if ($this->container['app_id'] === null) { - $invalidProperties[] = "'app_id' can't be null"; - } - if ($this->container['email_id'] === null) { - $invalidProperties[] = "'email_id' can't be null"; - } - if ($this->container['level'] === null) { - $invalidProperties[] = "'level' can't be null"; - } - if ($this->container['privacy_name'] === null) { - $invalidProperties[] = "'privacy_name' can't be null"; - } - if ($this->container['ad_network'] === null) { - $invalidProperties[] = "'ad_network' can't be null"; - } - if ($this->container['entity_type'] === null) { - $invalidProperties[] = "'entity_type' can't be null"; - } - if ($this->container['search_term_type'] === null) { - $invalidProperties[] = "'search_term_type' can't be null"; - } - if ($this->container['search_terms'] === null) { - $invalidProperties[] = "'search_terms' can't be null"; - } - if ($this->container['property_with_object_id'] === null) { - $invalidProperties[] = "'property_with_object_id' can't be null"; - } - if ($this->container['should_accept'] === null) { - $invalidProperties[] = "'should_accept' 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 filter_type - * - * @return string - */ - public function getFilterType() - { - return $this->container['filter_type']; - } - - /** - * Sets filter_type - * - * @param string $filter_type Specifies the type of filter, which is (CONSTANT). - * - * @return self - */ - public function setFilterType($filter_type) - { - if (is_null($filter_type)) { - throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!in_array($filter_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_type', must be one of '%s'", - $filter_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_type'] = $filter_type; - - return $this; - } - - /** - * Gets operation - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicPropertyFilterOperation - */ - public function getOperation() - { - return $this->container['operation']; - } - - /** - * Sets operation - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicPropertyFilterOperation $operation operation - * - * @return self - */ - public function setOperation($operation) - { - if (is_null($operation)) { - throw new \InvalidArgumentException('non-nullable operation cannot be null'); - } - $this->container['operation'] = $operation; - - return $this; - } - - /** - * Gets property - * - * @return string - */ - public function getProperty() - { - return $this->container['property']; - } - - /** - * Sets property - * - * @param string $property Specifies the name of the property that the filter is applied to. - * - * @return self - */ - public function setProperty($property) - { - if (is_null($property)) { - throw new \InvalidArgumentException('non-nullable property cannot be null'); - } - $this->container['property'] = $property; - - return $this; - } - - /** - * Gets association_category - * - * @return string - */ - public function getAssociationCategory() - { - return $this->container['association_category']; - } - - /** - * Sets association_category - * - * @param string $association_category Defines the category of the association (HUBSPOT_DEFINED, USER_DEFINED, INTEGRATOR_DEFINED, WORK). - * - * @return self - */ - public function setAssociationCategory($association_category) - { - if (is_null($association_category)) { - throw new \InvalidArgumentException('non-nullable association_category cannot be null'); - } - $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 The ID representing the type of association being filtered. - * - * @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; - } - - /** - * Gets coalescing_refine_by - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy - */ - public function getCoalescingRefineBy() - { - return $this->container['coalescing_refine_by']; - } - - /** - * Sets coalescing_refine_by - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy $coalescing_refine_by coalescing_refine_by - * - * @return self - */ - public function setCoalescingRefineBy($coalescing_refine_by) - { - if (is_null($coalescing_refine_by)) { - throw new \InvalidArgumentException('non-nullable coalescing_refine_by cannot be null'); - } - $this->container['coalescing_refine_by'] = $coalescing_refine_by; - - return $this; - } - - /** - * Gets list_id - * - * @return string - */ - public function getListId() - { - return $this->container['list_id']; - } - - /** - * Sets list_id - * - * @param string $list_id The ID of the list used in the property association filter. - * - * @return self - */ - public function setListId($list_id) - { - if (is_null($list_id)) { - throw new \InvalidArgumentException('non-nullable list_id cannot be null'); - } - $this->container['list_id'] = $list_id; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied by the filter (IN_LIST, NOT_IN_LIST). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets to_object_type - * - * @return string|null - */ - public function getToObjectType() - { - return $this->container['to_object_type']; - } - - /** - * Sets to_object_type - * - * @param string|null $to_object_type The type of object that the association filter is targeting. - * - * @return self - */ - public function setToObjectType($to_object_type) - { - if (is_null($to_object_type)) { - throw new \InvalidArgumentException('non-nullable to_object_type cannot be null'); - } - $this->container['to_object_type'] = $to_object_type; - - return $this; - } - - /** - * Gets to_object_type_id - * - * @return string|null - */ - public function getToObjectTypeId() - { - return $this->container['to_object_type_id']; - } - - /** - * Sets to_object_type_id - * - * @param string|null $to_object_type_id The ID representing the type of object that the property association filter is targeting. - * - * @return self - */ - public function setToObjectTypeId($to_object_type_id) - { - if (is_null($to_object_type_id)) { - throw new \InvalidArgumentException('non-nullable to_object_type_id cannot be null'); - } - $this->container['to_object_type_id'] = $to_object_type_id; - - return $this; - } - - /** - * Gets enable_tracking - * - * @return bool|null - */ - public function getEnableTracking() - { - return $this->container['enable_tracking']; - } - - /** - * Sets enable_tracking - * - * @param bool|null $enable_tracking Indicates whether tracking is enabled for the page view. - * - * @return self - */ - public function setEnableTracking($enable_tracking) - { - if (is_null($enable_tracking)) { - throw new \InvalidArgumentException('non-nullable enable_tracking cannot be null'); - } - $this->container['enable_tracking'] = $enable_tracking; - - return $this; - } - - /** - * Gets page_url - * - * @return string - */ - public function getPageUrl() - { - return $this->container['page_url']; - } - - /** - * Sets page_url - * - * @param string $page_url The URL of the page to be used in the filter. - * - * @return self - */ - public function setPageUrl($page_url) - { - if (is_null($page_url)) { - throw new \InvalidArgumentException('non-nullable page_url cannot be null'); - } - $this->container['page_url'] = $page_url; - - return $this; - } - - /** - * Gets pruning_refine_by - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterPruningRefineBy - */ - public function getPruningRefineBy() - { - return $this->container['pruning_refine_by']; - } - - /** - * Sets pruning_refine_by - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterPruningRefineBy $pruning_refine_by pruning_refine_by - * - * @return self - */ - public function setPruningRefineBy($pruning_refine_by) - { - if (is_null($pruning_refine_by)) { - throw new \InvalidArgumentException('non-nullable pruning_refine_by cannot be null'); - } - $this->container['pruning_refine_by'] = $pruning_refine_by; - - return $this; - } - - /** - * Gets cta_name - * - * @return string - */ - public function getCtaName() - { - return $this->container['cta_name']; - } - - /** - * Sets cta_name - * - * @param string $cta_name The name of the Call-to-Action (CTA) to be used in the filter. - * - * @return self - */ - public function setCtaName($cta_name) - { - if (is_null($cta_name)) { - throw new \InvalidArgumentException('non-nullable cta_name cannot be null'); - } - $this->container['cta_name'] = $cta_name; - - return $this; - } - - /** - * Gets event_id - * - * @return string - */ - public function getEventId() - { - return $this->container['event_id']; - } - - /** - * Sets event_id - * - * @param string $event_id The ID of the event to be used in the filter. - * - * @return self - */ - public function setEventId($event_id) - { - if (is_null($event_id)) { - throw new \InvalidArgumentException('non-nullable event_id cannot be null'); - } - $this->container['event_id'] = $event_id; - - return $this; - } - - /** - * Gets form_id - * - * @return string|null - */ - public function getFormId() - { - return $this->container['form_id']; - } - - /** - * Sets form_id - * - * @param string|null $form_id The ID of the form associated with the submission filter. - * - * @return self - */ - public function setFormId($form_id) - { - if (is_null($form_id)) { - throw new \InvalidArgumentException('non-nullable form_id cannot be null'); - } - $this->container['form_id'] = $form_id; - - return $this; - } - - /** - * Gets page_id - * - * @return string - */ - public function getPageId() - { - return $this->container['page_id']; - } - - /** - * Sets page_id - * - * @param string $page_id The ID of the page where the form submission occurred. - * - * @return self - */ - public function setPageId($page_id) - { - if (is_null($page_id)) { - throw new \InvalidArgumentException('non-nullable page_id cannot be null'); - } - $this->container['page_id'] = $page_id; - - return $this; - } - - /** - * Gets event_type_id - * - * @return string - */ - public function getEventTypeId() - { - return $this->container['event_type_id']; - } - - /** - * Sets event_type_id - * - * @param string $event_type_id The identifier for the type of event in the unified events filter. - * - * @return self - */ - public function setEventTypeId($event_type_id) - { - if (is_null($event_type_id)) { - throw new \InvalidArgumentException('non-nullable event_type_id cannot be null'); - } - $this->container['event_type_id'] = $event_type_id; - - return $this; - } - - /** - * Gets filter_lines - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicEventFilterMetadata[] - */ - public function getFilterLines() - { - return $this->container['filter_lines']; - } - - /** - * Sets filter_lines - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicEventFilterMetadata[] $filter_lines filter_lines - * - * @return self - */ - public function setFilterLines($filter_lines) - { - if (is_null($filter_lines)) { - throw new \InvalidArgumentException('non-nullable filter_lines cannot be null'); - } - $this->container['filter_lines'] = $filter_lines; - - return $this; - } - - /** - * Gets accepted_statuses - * - * @return string[] - */ - public function getAcceptedStatuses() - { - return $this->container['accepted_statuses']; - } - - /** - * Sets accepted_statuses - * - * @param string[] $accepted_statuses accepted_statuses - * - * @return self - */ - public function setAcceptedStatuses($accepted_statuses) - { - if (is_null($accepted_statuses)) { - throw new \InvalidArgumentException('non-nullable accepted_statuses cannot be null'); - } - $this->container['accepted_statuses'] = $accepted_statuses; - - return $this; - } - - /** - * Gets subscription_ids - * - * @return string[] - */ - public function getSubscriptionIds() - { - return $this->container['subscription_ids']; - } - - /** - * Sets subscription_ids - * - * @param string[] $subscription_ids subscription_ids - * - * @return self - */ - public function setSubscriptionIds($subscription_ids) - { - if (is_null($subscription_ids)) { - throw new \InvalidArgumentException('non-nullable subscription_ids cannot be null'); - } - $this->container['subscription_ids'] = $subscription_ids; - - return $this; - } - - /** - * Gets subscription_type - * - * @return string - */ - public function getSubscriptionType() - { - return $this->container['subscription_type']; - } - - /** - * Sets subscription_type - * - * @param string $subscription_type Defines the type of subscription related to the filter (PORTAL_WIDE, BUSINESS_UNIT_WIDE, INDIVIDUAL_SUBSCRIPTION) - * - * @return self - */ - public function setSubscriptionType($subscription_type) - { - if (is_null($subscription_type)) { - throw new \InvalidArgumentException('non-nullable subscription_type cannot be null'); - } - $this->container['subscription_type'] = $subscription_type; - - return $this; - } - - /** - * Gets accepted_opt_states - * - * @return string[] - */ - public function getAcceptedOptStates() - { - return $this->container['accepted_opt_states']; - } - - /** - * Sets accepted_opt_states - * - * @param string[] $accepted_opt_states accepted_opt_states - * - * @return self - */ - public function setAcceptedOptStates($accepted_opt_states) - { - if (is_null($accepted_opt_states)) { - throw new \InvalidArgumentException('non-nullable accepted_opt_states cannot be null'); - } - $this->container['accepted_opt_states'] = $accepted_opt_states; - - return $this; - } - - /** - * Gets business_unit_id - * - * @return string|null - */ - public function getBusinessUnitId() - { - return $this->container['business_unit_id']; - } - - /** - * Sets business_unit_id - * - * @param string|null $business_unit_id The ID of the business unit associated with the subscription filter. - * - * @return self - */ - public function setBusinessUnitId($business_unit_id) - { - if (is_null($business_unit_id)) { - throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); - } - $this->container['business_unit_id'] = $business_unit_id; - - return $this; - } - - /** - * Gets channel - * - * @return string - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string $channel Specifies the communication channel associated with the subscription filter (EMAIL, WHATSAPP, SMS). - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $this->container['channel'] = $channel; - - return $this; - } - - /** - * Gets campaign_id - * - * @return string - */ - public function getCampaignId() - { - return $this->container['campaign_id']; - } - - /** - * Sets campaign_id - * - * @param string $campaign_id The ID of the campaign that influences the filter. - * - * @return self - */ - public function setCampaignId($campaign_id) - { - if (is_null($campaign_id)) { - throw new \InvalidArgumentException('non-nullable campaign_id cannot be null'); - } - $this->container['campaign_id'] = $campaign_id; - - return $this; - } - - /** - * Gets survey_id - * - * @return string - */ - public function getSurveyId() - { - return $this->container['survey_id']; - } - - /** - * Sets survey_id - * - * @param string $survey_id The ID of the survey used in the filter. - * - * @return self - */ - public function setSurveyId($survey_id) - { - if (is_null($survey_id)) { - throw new \InvalidArgumentException('non-nullable survey_id cannot be null'); - } - $this->container['survey_id'] = $survey_id; - - return $this; - } - - /** - * Gets survey_answer_col_id - * - * @return string|null - */ - public function getSurveyAnswerColId() - { - return $this->container['survey_answer_col_id']; - } - - /** - * Sets survey_answer_col_id - * - * @param string|null $survey_answer_col_id The column ID of the survey answer used in the filter. - * - * @return self - */ - public function setSurveyAnswerColId($survey_answer_col_id) - { - if (is_null($survey_answer_col_id)) { - throw new \InvalidArgumentException('non-nullable survey_answer_col_id cannot be null'); - } - $this->container['survey_answer_col_id'] = $survey_answer_col_id; - - return $this; - } - - /** - * Gets survey_answer_row_id - * - * @return string|null - */ - public function getSurveyAnswerRowId() - { - return $this->container['survey_answer_row_id']; - } - - /** - * Sets survey_answer_row_id - * - * @param string|null $survey_answer_row_id The row ID of the survey answer used in the filter. - * - * @return self - */ - public function setSurveyAnswerRowId($survey_answer_row_id) - { - if (is_null($survey_answer_row_id)) { - throw new \InvalidArgumentException('non-nullable survey_answer_row_id cannot be null'); - } - $this->container['survey_answer_row_id'] = $survey_answer_row_id; - - return $this; - } - - /** - * Gets survey_question - * - * @return string - */ - public function getSurveyQuestion() - { - return $this->container['survey_question']; - } - - /** - * Sets survey_question - * - * @param string $survey_question The question from the survey used in the filter. - * - * @return self - */ - public function setSurveyQuestion($survey_question) - { - if (is_null($survey_question)) { - throw new \InvalidArgumentException('non-nullable survey_question cannot be null'); - } - $this->container['survey_question'] = $survey_question; - - return $this; - } - - /** - * Gets value_comparison - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicSurveyMonkeyValueFilterValueComparison - */ - public function getValueComparison() - { - return $this->container['value_comparison']; - } - - /** - * Sets value_comparison - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicSurveyMonkeyValueFilterValueComparison $value_comparison value_comparison - * - * @return self - */ - public function setValueComparison($value_comparison) - { - if (is_null($value_comparison)) { - throw new \InvalidArgumentException('non-nullable value_comparison cannot be null'); - } - $this->container['value_comparison'] = $value_comparison; - - return $this; - } - - /** - * Gets webinar_id - * - * @return string|null - */ - public function getWebinarId() - { - return $this->container['webinar_id']; - } - - /** - * Sets webinar_id - * - * @param string|null $webinar_id The ID of the webinar associated with the filter. - * - * @return self - */ - public function setWebinarId($webinar_id) - { - if (is_null($webinar_id)) { - throw new \InvalidArgumentException('non-nullable webinar_id cannot be null'); - } - $this->container['webinar_id'] = $webinar_id; - - return $this; - } - - /** - * Gets app_id - * - * @return string - */ - public function getAppId() - { - return $this->container['app_id']; - } - - /** - * Sets app_id - * - * @param string $app_id The ID of the application associated with the email event filter. - * - * @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 click_url - * - * @return string|null - */ - public function getClickUrl() - { - return $this->container['click_url']; - } - - /** - * Sets click_url - * - * @param string|null $click_url The URL that was clicked in the email event. - * - * @return self - */ - public function setClickUrl($click_url) - { - if (is_null($click_url)) { - throw new \InvalidArgumentException('non-nullable click_url cannot be null'); - } - $this->container['click_url'] = $click_url; - - return $this; - } - - /** - * Gets email_id - * - * @return string - */ - public function getEmailId() - { - return $this->container['email_id']; - } - - /** - * Sets email_id - * - * @param string $email_id The ID of the email associated with the event filter. - * - * @return self - */ - public function setEmailId($email_id) - { - if (is_null($email_id)) { - throw new \InvalidArgumentException('non-nullable email_id cannot be null'); - } - $this->container['email_id'] = $email_id; - - return $this; - } - - /** - * Gets level - * - * @return string - */ - public function getLevel() - { - return $this->container['level']; - } - - /** - * Sets level - * - * @param string $level Specifies the level of the email event, such as EMAIL_API_CAMPAIGN_GROUP. - * - * @return self - */ - public function setLevel($level) - { - if (is_null($level)) { - throw new \InvalidArgumentException('non-nullable level cannot be null'); - } - $this->container['level'] = $level; - - return $this; - } - - /** - * Gets privacy_name - * - * @return string - */ - public function getPrivacyName() - { - return $this->container['privacy_name']; - } - - /** - * Sets privacy_name - * - * @param string $privacy_name The name of the privacy setting used in the filter. - * - * @return self - */ - public function setPrivacyName($privacy_name) - { - if (is_null($privacy_name)) { - throw new \InvalidArgumentException('non-nullable privacy_name cannot be null'); - } - $this->container['privacy_name'] = $privacy_name; - - return $this; - } - - /** - * Gets ad_network - * - * @return string - */ - public function getAdNetwork() - { - return $this->container['ad_network']; - } - - /** - * Sets ad_network - * - * @param string $ad_network Ad network (ADWORDS, FACEBOOK, LINKEDIN, ALL) - * - * @return self - */ - public function setAdNetwork($ad_network) - { - if (is_null($ad_network)) { - throw new \InvalidArgumentException('non-nullable ad_network cannot be null'); - } - $this->container['ad_network'] = $ad_network; - - return $this; - } - - /** - * Gets entity_type - * - * @return string - */ - public function getEntityType() - { - return $this->container['entity_type']; - } - - /** - * Sets entity_type - * - * @param string $entity_type Type of ad entity (KEYWORD, ADGROUP, AD, CAMPAIGN) - * - * @return self - */ - public function setEntityType($entity_type) - { - if (is_null($entity_type)) { - throw new \InvalidArgumentException('non-nullable entity_type cannot be null'); - } - $this->container['entity_type'] = $entity_type; - - return $this; - } - - /** - * Gets search_term_type - * - * @return string - */ - public function getSearchTermType() - { - return $this->container['search_term_type']; - } - - /** - * Sets search_term_type - * - * @param string $search_term_type Search term to match an ad - * - * @return self - */ - public function setSearchTermType($search_term_type) - { - if (is_null($search_term_type)) { - throw new \InvalidArgumentException('non-nullable search_term_type cannot be null'); - } - $this->container['search_term_type'] = $search_term_type; - - return $this; - } - - /** - * Gets search_terms - * - * @return string[] - */ - public function getSearchTerms() - { - return $this->container['search_terms']; - } - - /** - * Sets search_terms - * - * @param string[] $search_terms search_terms - * - * @return self - */ - public function setSearchTerms($search_terms) - { - if (is_null($search_terms)) { - throw new \InvalidArgumentException('non-nullable search_terms cannot be null'); - } - $this->container['search_terms'] = $search_terms; - - return $this; - } - - /** - * Gets metadata - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicInListFilterMetadata|null - */ - public function getMetadata() - { - return $this->container['metadata']; - } - - /** - * Sets metadata - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicInListFilterMetadata|null $metadata metadata - * - * @return self - */ - public function setMetadata($metadata) - { - if (is_null($metadata)) { - throw new \InvalidArgumentException('non-nullable metadata cannot be null'); - } - $this->container['metadata'] = $metadata; - - return $this; - } - - /** - * Gets property_with_object_id - * - * @return string - */ - public function getPropertyWithObjectId() - { - return $this->container['property_with_object_id']; - } - - /** - * Sets property_with_object_id - * - * @param string $property_with_object_id The property associated with the object ID in the filter. - * - * @return self - */ - public function setPropertyWithObjectId($property_with_object_id) - { - if (is_null($property_with_object_id)) { - throw new \InvalidArgumentException('non-nullable property_with_object_id cannot be null'); - } - $this->container['property_with_object_id'] = $property_with_object_id; - - return $this; - } - - /** - * Gets should_accept - * - * @return bool - */ - public function getShouldAccept() - { - return $this->container['should_accept']; - } - - /** - * Sets should_accept - * - * @param bool $should_accept Indicates whether the filter should accept the condition. - * - * @return self - */ - public function setShouldAccept($should_accept) - { - if (is_null($should_accept)) { - throw new \InvalidArgumentException('non-nullable should_accept cannot be null'); - } - $this->container['should_accept'] = $should_accept; - - return $this; - } - - /** - * Gets source - * - * @return string|null - */ - public function getSource() - { - return $this->container['source']; - } - - /** - * Sets source - * - * @param string|null $source Defines the source of the constant filter. - * - * @return self - */ - public function setSource($source) - { - if (is_null($source)) { - throw new \InvalidArgumentException('non-nullable source cannot be null'); - } - $this->container['source'] = $source; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Lists/Model/PublicPropertyAssociationInListFilter.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php deleted file mode 100644 index f0ce3a00..00000000 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php +++ /dev/null @@ -1,626 +0,0 @@ - - */ -class PublicPropertyAssociationInListFilter implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PublicPropertyAssociationInListFilter'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'coalescing_refine_by' => '\HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy', - 'filter_type' => 'string', - 'list_id' => 'string', - 'operator' => 'string', - 'property_with_object_id' => 'string', - 'to_object_type_id' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'coalescing_refine_by' => null, - 'filter_type' => null, - 'list_id' => null, - 'operator' => null, - 'property_with_object_id' => null, - 'to_object_type_id' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'coalescing_refine_by' => false, - 'filter_type' => false, - 'list_id' => false, - 'operator' => false, - 'property_with_object_id' => false, - 'to_object_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 = [ - 'coalescing_refine_by' => 'coalescingRefineBy', - 'filter_type' => 'filterType', - 'list_id' => 'listId', - 'operator' => 'operator', - 'property_with_object_id' => 'propertyWithObjectId', - 'to_object_type_id' => 'toObjectTypeId' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'coalescing_refine_by' => 'setCoalescingRefineBy', - 'filter_type' => 'setFilterType', - 'list_id' => 'setListId', - 'operator' => 'setOperator', - 'property_with_object_id' => 'setPropertyWithObjectId', - 'to_object_type_id' => 'setToObjectTypeId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'coalescing_refine_by' => 'getCoalescingRefineBy', - 'filter_type' => 'getFilterType', - 'list_id' => 'getListId', - 'operator' => 'getOperator', - 'property_with_object_id' => 'getPropertyWithObjectId', - 'to_object_type_id' => 'getToObjectTypeId' - ]; - - /** - * 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 FILTER_TYPE_PROPERTY_ASSOCIATION = 'PROPERTY_ASSOCIATION'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getFilterTypeAllowableValues() - { - return [ - self::FILTER_TYPE_PROPERTY_ASSOCIATION, - ]; - } - - /** - * 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('coalescing_refine_by', $data ?? [], null); - $this->setIfExists('filter_type', $data ?? [], 'PROPERTY_ASSOCIATION'); - $this->setIfExists('list_id', $data ?? [], null); - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('property_with_object_id', $data ?? [], null); - $this->setIfExists('to_object_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['coalescing_refine_by'] === null) { - $invalidProperties[] = "'coalescing_refine_by' can't be null"; - } - if ($this->container['filter_type'] === null) { - $invalidProperties[] = "'filter_type' can't be null"; - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'filter_type', must be one of '%s'", - $this->container['filter_type'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['list_id'] === null) { - $invalidProperties[] = "'list_id' can't be null"; - } - if ($this->container['operator'] === null) { - $invalidProperties[] = "'operator' can't be null"; - } - if ($this->container['property_with_object_id'] === null) { - $invalidProperties[] = "'property_with_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 coalescing_refine_by - * - * @return \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy - */ - public function getCoalescingRefineBy() - { - return $this->container['coalescing_refine_by']; - } - - /** - * Sets coalescing_refine_by - * - * @param \HubSpot\Client\Crm\Lists\Model\PublicFormSubmissionFilterCoalescingRefineBy $coalescing_refine_by coalescing_refine_by - * - * @return self - */ - public function setCoalescingRefineBy($coalescing_refine_by) - { - if (is_null($coalescing_refine_by)) { - throw new \InvalidArgumentException('non-nullable coalescing_refine_by cannot be null'); - } - $this->container['coalescing_refine_by'] = $coalescing_refine_by; - - return $this; - } - - /** - * Gets filter_type - * - * @return string - */ - public function getFilterType() - { - return $this->container['filter_type']; - } - - /** - * Sets filter_type - * - * @param string $filter_type Indicates the type of filter being applied (PROPERTY_ASSOCIATION). - * - * @return self - */ - public function setFilterType($filter_type) - { - if (is_null($filter_type)) { - throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); - } - $allowedValues = $this->getFilterTypeAllowableValues(); - if (!in_array($filter_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'filter_type', must be one of '%s'", - $filter_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['filter_type'] = $filter_type; - - return $this; - } - - /** - * Gets list_id - * - * @return string - */ - public function getListId() - { - return $this->container['list_id']; - } - - /** - * Sets list_id - * - * @param string $list_id The ID of the list used in the property association filter. - * - * @return self - */ - public function setListId($list_id) - { - if (is_null($list_id)) { - throw new \InvalidArgumentException('non-nullable list_id cannot be null'); - } - $this->container['list_id'] = $list_id; - - return $this; - } - - /** - * Gets operator - * - * @return string - */ - public function getOperator() - { - return $this->container['operator']; - } - - /** - * Sets operator - * - * @param string $operator Defines the operation to be applied by the filter (IN_LIST, NOT_IN_LIST). - * - * @return self - */ - public function setOperator($operator) - { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $this->container['operator'] = $operator; - - return $this; - } - - /** - * Gets property_with_object_id - * - * @return string - */ - public function getPropertyWithObjectId() - { - return $this->container['property_with_object_id']; - } - - /** - * Sets property_with_object_id - * - * @param string $property_with_object_id The property associated with the object ID in the filter. - * - * @return self - */ - public function setPropertyWithObjectId($property_with_object_id) - { - if (is_null($property_with_object_id)) { - throw new \InvalidArgumentException('non-nullable property_with_object_id cannot be null'); - } - $this->container['property_with_object_id'] = $property_with_object_id; - - return $this; - } - - /** - * Gets to_object_type_id - * - * @return string|null - */ - public function getToObjectTypeId() - { - return $this->container['to_object_type_id']; - } - - /** - * Sets to_object_type_id - * - * @param string|null $to_object_type_id The ID representing the type of object that the property association filter is targeting. - * - * @return self - */ - public function setToObjectTypeId($to_object_type_id) - { - if (is_null($to_object_type_id)) { - throw new \InvalidArgumentException('non-nullable to_object_type_id cannot be null'); - } - $this->container['to_object_type_id'] = $to_object_type_id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Pipelines/Api/PipelineAuditsApi.php b/codegen/Crm/Objects/Api/AdvancedApi.php similarity index 64% rename from codegen/Crm/Pipelines/Api/PipelineAuditsApi.php rename to codegen/Crm/Objects/Api/AdvancedApi.php index 05dea032..93efb6ed 100644 --- a/codegen/Crm/Pipelines/Api/PipelineAuditsApi.php +++ b/codegen/Crm/Objects/Api/AdvancedApi.php @@ -1,18 +1,18 @@ [ + 'merge' => [ 'application/json', ], ]; @@ -126,40 +125,40 @@ public function getConfig() } /** - * Operation getAudit + * Operation merge * - * Return an audit of all changes to the pipeline + * Merge two objects with same type * - * @param string $object_type The object type of the pipeline audit being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier for the pipeline whose audit history is being retrieved. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format + * @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\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function getAudit($object_type, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) + public function merge($object_type, $public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->getAuditWithHttpInfo($object_type, $pipeline_id, $contentType); + list($response) = $this->mergeWithHttpInfo($object_type, $public_merge_input, $contentType); return $response; } /** - * Operation getAuditWithHttpInfo + * Operation mergeWithHttpInfo * - * Return an audit of all changes to the pipeline + * Merge two objects with same type * - * @param string $object_type The object type of the pipeline audit being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier for the pipeline whose audit history is being retrieved. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format + * @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\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getAuditWithHttpInfo($object_type, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) + public function mergeWithHttpInfo($object_type, $public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->getAuditRequest($object_type, $pipeline_id, $contentType); + $request = $this->mergeRequest($object_type, $public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -169,10 +168,10 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -187,13 +186,13 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content switch($statusCode) { case 200: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', + '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', $request, $response, ); default: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', + '\HubSpot\Client\Crm\Objects\Model\Error', $request, $response, ); @@ -215,7 +214,7 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content } return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', + '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', $request, $response, ); @@ -224,7 +223,7 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', + '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -232,7 +231,7 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', + '\HubSpot\Client\Crm\Objects\Model\Error', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -245,20 +244,20 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content } /** - * Operation getAuditAsync + * Operation mergeAsync * - * Return an audit of all changes to the pipeline + * Merge two objects with same type * - * @param string $object_type The object type of the pipeline audit being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier for the pipeline whose audit history is being retrieved. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\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 getAuditAsync($object_type, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) + public function mergeAsync($object_type, $public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->getAuditAsyncWithHttpInfo($object_type, $pipeline_id, $contentType) + return $this->mergeAsyncWithHttpInfo($object_type, $public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -267,21 +266,21 @@ function ($response) { } /** - * Operation getAuditAsyncWithHttpInfo + * Operation mergeAsyncWithHttpInfo * - * Return an audit of all changes to the pipeline + * Merge two objects with same type * - * @param string $object_type The object type of the pipeline audit being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier for the pipeline whose audit history is being retrieved. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\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 getAuditAsyncWithHttpInfo($object_type, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) + public function mergeAsyncWithHttpInfo($object_type, $public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging'; - $request = $this->getAuditRequest($object_type, $pipeline_id, $contentType); + $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; + $request = $this->mergeRequest($object_type, $public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -303,8 +302,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -312,42 +311,42 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); } /** - * Create request for operation 'getAudit' + * Create request for operation 'merge' * - * @param string $object_type The object type of the pipeline audit being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier for the pipeline whose audit history is being retrieved. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\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 getAuditRequest($object_type, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) + public function mergeRequest($object_type, $public_merge_input, string $contentType = self::contentTypes['merge'][0]) { // verify the required parameter 'object_type' is set if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getAudit' + 'Missing the required parameter $object_type when calling merge' ); } - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 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 $pipeline_id when calling getAudit' + 'Missing the required parameter $public_merge_input when calling merge' ); } - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/audit'; + $resourcePath = '/crm/v3/objects/{objectType}/merge'; $formParams = []; $queryParams = []; $headerParams = []; @@ -364,14 +363,6 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType $resourcePath ); } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -381,7 +372,14 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + } else { + $httpBody = $public_merge_input; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -398,7 +396,7 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -424,7 +422,7 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/codegen/Crm/Objects/Api/BasicApi.php b/codegen/Crm/Objects/Api/BasicApi.php index fb2e22d5..a0471120 100644 --- a/codegen/Crm/Objects/Api/BasicApi.php +++ b/codegen/Crm/Objects/Api/BasicApi.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -29,7 +29,6 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; @@ -142,17 +141,17 @@ public function getConfig() * * Archive * - * @param string $object_type (required) * @param string $object_id (required) + * @param string $object_type (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\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($object_type, $object_id, string $contentType = self::contentTypes['archive'][0]) + public function archive($object_id, $object_type, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($object_type, $object_id, $contentType); + $this->archiveWithHttpInfo($object_id, $object_type, $contentType); } /** @@ -160,17 +159,17 @@ public function archive($object_type, $object_id, string $contentType = self::co * * Archive * - * @param string $object_type (required) * @param string $object_id (required) + * @param string $object_type (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\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($object_type, $object_id, string $contentType = self::contentTypes['archive'][0]) + public function archiveWithHttpInfo($object_id, $object_type, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($object_type, $object_id, $contentType); + $request = $this->archiveRequest($object_id, $object_type, $contentType); try { $options = $this->createHttpClientOption(); @@ -180,10 +179,10 @@ public function archiveWithHttpInfo($object_type, $object_id, string $contentTyp throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -218,16 +217,16 @@ public function archiveWithHttpInfo($object_type, $object_id, string $contentTyp * * Archive * - * @param string $object_type (required) * @param string $object_id (required) + * @param string $object_type (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($object_type, $object_id, string $contentType = self::contentTypes['archive'][0]) + public function archiveAsync($object_id, $object_type, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($object_type, $object_id, $contentType) + return $this->archiveAsyncWithHttpInfo($object_id, $object_type, $contentType) ->then( function ($response) { return $response[0]; @@ -240,17 +239,17 @@ function ($response) { * * Archive * - * @param string $object_type (required) * @param string $object_id (required) + * @param string $object_type (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($object_type, $object_id, string $contentType = self::contentTypes['archive'][0]) + public function archiveAsyncWithHttpInfo($object_id, $object_type, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($object_type, $object_id, $contentType); + $request = $this->archiveRequest($object_id, $object_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -259,8 +258,8 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -268,8 +267,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -278,27 +277,27 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) * @param string $object_id (required) + * @param string $object_type (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($object_type, $object_id, string $contentType = self::contentTypes['archive'][0]) + public function archiveRequest($object_id, $object_type, string $contentType = self::contentTypes['archive'][0]) { - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 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_type when calling archive' + 'Missing the required parameter $object_id when calling archive' ); } - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling archive' + 'Missing the required parameter $object_type when calling archive' ); } @@ -313,18 +312,18 @@ public function archiveRequest($object_type, $object_id, string $contentType = s // path params - if ($object_type !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } // path params - if ($object_id !== null) { + if ($object_type !== null) { $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), $resourcePath ); } @@ -354,7 +353,7 @@ public function archiveRequest($object_type, $object_id, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -431,10 +430,10 @@ public function createWithHttpInfo($object_type, $simple_public_object_input_for throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -565,8 +564,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -574,8 +573,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -638,7 +637,7 @@ public function createRequest($object_type, $simple_public_object_input_for_crea 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)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -659,7 +658,7 @@ public function createRequest($object_type, $simple_public_object_input_for_crea } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -697,22 +696,22 @@ public function createRequest($object_type, $simple_public_object_input_for_crea * * Read * - * @param string $object_type (required) * @param string $object_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 string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 string|null $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 $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\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Model\Error */ - public function getById($object_type, $object_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getById($object_id, $object_type, $archived = false, $associations = null, $id_property = null, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($object_type, $object_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + list($response) = $this->getByIdWithHttpInfo($object_id, $object_type, $archived, $associations, $id_property, $properties, $properties_with_history, $contentType); return $response; } @@ -721,22 +720,22 @@ public function getById($object_type, $object_id, $properties = null, $propertie * * Read * - * @param string $object_type (required) * @param string $object_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 string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 string|null $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 $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\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\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($object_type, $object_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getByIdWithHttpInfo($object_id, $object_type, $archived = false, $associations = null, $id_property = null, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($object_type, $object_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + $request = $this->getByIdRequest($object_id, $object_type, $archived, $associations, $id_property, $properties, $properties_with_history, $contentType); try { $options = $this->createHttpClientOption(); @@ -746,10 +745,10 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -826,21 +825,21 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null * * Read * - * @param string $object_type (required) * @param string $object_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 string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 string|null $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 $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_type, $object_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getByIdAsync($object_id, $object_type, $archived = false, $associations = null, $id_property = null, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($object_type, $object_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) + return $this->getByIdAsyncWithHttpInfo($object_id, $object_type, $archived, $associations, $id_property, $properties, $properties_with_history, $contentType) ->then( function ($response) { return $response[0]; @@ -853,22 +852,22 @@ function ($response) { * * Read * - * @param string $object_type (required) * @param string $object_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 string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 string|null $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 $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_type, $object_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getByIdAsyncWithHttpInfo($object_id, $object_type, $archived = false, $associations = null, $id_property = null, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($object_type, $object_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + $request = $this->getByIdRequest($object_id, $object_type, $archived, $associations, $id_property, $properties, $properties_with_history, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -890,8 +889,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -899,8 +898,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -909,32 +908,32 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $object_type (required) * @param string $object_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 string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 string|null $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 $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_type, $object_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getByIdRequest($object_id, $object_type, $archived = false, $associations = null, $id_property = null, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getById'][0]) { - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 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_type when calling getById' + 'Missing the required parameter $object_id when calling getById' ); } - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getById' + 'Missing the required parameter $object_type when calling getById' ); } @@ -953,17 +952,17 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties, - 'properties', // param base name - 'array', // openApiType + $archived, + 'archived', // param base name + 'boolean', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties_with_history, - 'propertiesWithHistory', // param base name + $associations, + 'associations', // param base name 'array', // openApiType 'form', // style true, // explode @@ -971,27 +970,27 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $associations, - 'associations', // param base name - 'array', // openApiType + $id_property, + 'idProperty', // param base name + 'string', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType + $properties, + 'properties', // param base name + 'array', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id_property, - 'idProperty', // param base name - 'string', // openApiType + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType 'form', // style true, // explode false // required @@ -999,18 +998,18 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr // path params - if ($object_type !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } // path params - if ($object_id !== null) { + if ($object_type !== null) { $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), $resourcePath ); } @@ -1040,7 +1039,7 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1079,21 +1078,21 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr * List * * @param string $object_type (required) - * @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 bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Model\Error */ - public function getPage($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function getPage($object_type, $after = null, $archived = false, $associations = null, $limit = 10, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($object_type, $limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + list($response) = $this->getPageWithHttpInfo($object_type, $after, $archived, $associations, $limit, $properties, $properties_with_history, $contentType); return $response; } @@ -1103,21 +1102,21 @@ public function getPage($object_type, $limit = 10, $after = null, $properties = * List * * @param string $object_type (required) - * @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 bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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\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\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function getPageWithHttpInfo($object_type, $after = null, $archived = false, $associations = null, $limit = 10, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($object_type, $limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + $request = $this->getPageRequest($object_type, $after, $archived, $associations, $limit, $properties, $properties_with_history, $contentType); try { $options = $this->createHttpClientOption(); @@ -1127,10 +1126,10 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1208,20 +1207,20 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p * List * * @param string $object_type (required) - * @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 bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 getPageAsync($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function getPageAsync($object_type, $after = null, $archived = false, $associations = null, $limit = 10, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($object_type, $limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) + return $this->getPageAsyncWithHttpInfo($object_type, $after, $archived, $associations, $limit, $properties, $properties_with_history, $contentType) ->then( function ($response) { return $response[0]; @@ -1235,21 +1234,21 @@ function ($response) { * List * * @param string $object_type (required) - * @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 bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 getPageAsyncWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function getPageAsyncWithHttpInfo($object_type, $after = null, $archived = false, $associations = null, $limit = 10, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($object_type, $limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + $request = $this->getPageRequest($object_type, $after, $archived, $associations, $limit, $properties, $properties_with_history, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1271,8 +1270,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -1280,8 +1279,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -1291,18 +1290,18 @@ function ($exception) { * Create request for operation 'getPage' * * @param string $object_type (required) - * @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 bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @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 int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 getPageRequest($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function getPageRequest($object_type, $after = null, $archived = false, $associations = null, $limit = 10, $properties = null, $properties_with_history = null, string $contentType = self::contentTypes['getPage'][0]) { // verify the required parameter 'object_type' is set @@ -1328,26 +1327,26 @@ public function getPageRequest($object_type, $limit = 10, $after = null, $proper // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType + $after, + 'after', // param base name + 'string', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name - 'string', // openApiType + $archived, + 'archived', // param base name + 'boolean', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties, - 'properties', // param base name + $associations, + 'associations', // param base name 'array', // openApiType 'form', // style true, // explode @@ -1355,17 +1354,17 @@ public function getPageRequest($object_type, $limit = 10, $after = null, $proper ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties_with_history, - 'propertiesWithHistory', // param base name - 'array', // openApiType + $limit, + 'limit', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $associations, - 'associations', // param base name + $properties, + 'properties', // param base name 'array', // openApiType 'form', // style true, // explode @@ -1373,9 +1372,9 @@ public function getPageRequest($object_type, $limit = 10, $after = null, $proper ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType 'form', // style true, // explode false // required @@ -1416,7 +1415,7 @@ public function getPageRequest($object_type, $limit = 10, $after = null, $proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1497,10 +1496,10 @@ public function updateWithHttpInfo($object_id, $object_type, $simple_public_obje throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1635,8 +1634,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -1644,8 +1643,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -1735,7 +1734,7 @@ public function updateRequest($object_id, $object_type, $simple_public_object_in 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)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1756,7 +1755,7 @@ public function updateRequest($object_id, $object_type, $simple_public_object_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/BatchApi.php b/codegen/Crm/Objects/Api/BatchApi.php index 2102d50b..c6769012 100644 --- a/codegen/Crm/Objects/Api/BatchApi.php +++ b/codegen/Crm/Objects/Api/BatchApi.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -29,7 +29,6 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; @@ -80,13 +79,13 @@ class BatchApi 'create' => [ 'application/json', ], - 'read' => [ + 'postCrmV3ObjectsObjectTypeBatchUpsert' => [ 'application/json', ], - 'update' => [ + 'read' => [ 'application/json', ], - 'upsert' => [ + 'update' => [ 'application/json', ], ]; @@ -180,10 +179,10 @@ public function archiveWithHttpInfo($object_type, $batch_input_simple_public_obj throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -259,8 +258,8 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -268,8 +267,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -332,7 +331,7 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i 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)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -353,7 +352,7 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -430,10 +429,10 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -578,8 +577,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -587,8 +586,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -651,7 +650,7 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba 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)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -672,7 +671,7 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -706,42 +705,40 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba } /** - * Operation read + * Operation postCrmV3ObjectsObjectTypeBatchUpsert * - * Read a batch of objects by internal ID, or unique property values + * Create or update a batch of objects by unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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['postCrmV3ObjectsObjectTypeBatchUpsert'] 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 + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ - public function read($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function postCrmV3ObjectsObjectTypeBatchUpsert($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'][0]) { - list($response) = $this->readWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); + list($response) = $this->postCrmV3ObjectsObjectTypeBatchUpsertWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); return $response; } /** - * Operation readWithHttpInfo + * Operation postCrmV3ObjectsObjectTypeBatchUpsertWithHttpInfo * - * Read a batch of objects by internal ID, or unique property values + * Create or update a batch of objects by unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'] 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) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function postCrmV3ObjectsObjectTypeBatchUpsertWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'][0]) { - $request = $this->readRequest($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); + $request = $this->postCrmV3ObjectsObjectTypeBatchUpsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); try { $options = $this->createHttpClientOption(); @@ -751,10 +748,10 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -769,13 +766,13 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o switch($statusCode) { case 200: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', $request, $response, ); case 207: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', $request, $response, ); @@ -803,7 +800,7 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o } return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', $request, $response, ); @@ -812,7 +809,7 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -820,7 +817,7 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o case 207: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -841,21 +838,20 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o } /** - * Operation readAsync + * Operation postCrmV3ObjectsObjectTypeBatchUpsertAsync * - * Read a batch of objects by internal ID, or unique property values + * Create or update a batch of objects by unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function postCrmV3ObjectsObjectTypeBatchUpsertAsync($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'][0]) { - return $this->readAsyncWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType) + return $this->postCrmV3ObjectsObjectTypeBatchUpsertAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType) ->then( function ($response) { return $response[0]; @@ -864,22 +860,21 @@ function ($response) { } /** - * Operation readAsyncWithHttpInfo + * Operation postCrmV3ObjectsObjectTypeBatchUpsertAsyncWithHttpInfo * - * Read a batch of objects by internal ID, or unique property values + * Create or update a batch of objects by unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function postCrmV3ObjectsObjectTypeBatchUpsertAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'][0]) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); + $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->postCrmV3ObjectsObjectTypeBatchUpsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -901,8 +896,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -910,59 +905,48 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); } /** - * Create request for operation 'read' + * Create request for operation 'postCrmV3ObjectsObjectTypeBatchUpsert' * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function postCrmV3ObjectsObjectTypeBatchUpsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['postCrmV3ObjectsObjectTypeBatchUpsert'][0]) { // verify the required parameter 'object_type' is set if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling read' + 'Missing the required parameter $object_type when calling postCrmV3ObjectsObjectTypeBatchUpsert' ); } - // 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_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_read_input_simple_public_object_id when calling read' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling postCrmV3ObjectsObjectTypeBatchUpsert' ); } - - $resourcePath = '/crm/v3/objects/{objectType}/batch/read'; + $resourcePath = '/crm/v3/objects/{objectType}/batch/upsert'; $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 @@ -982,12 +966,12 @@ public function readRequest($object_type, $batch_read_input_simple_public_object ); // for model (json/xml) - if (isset($batch_read_input_simple_public_object_id)) { + 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 = json_encode($1, JSON_THROW_ON_ERROR); } else { - $httpBody = $batch_read_input_simple_public_object_id; + $httpBody = $batch_input_simple_public_object_batch_input_upsert; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1006,7 +990,7 @@ public function readRequest($object_type, $batch_read_input_simple_public_object } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1040,40 +1024,42 @@ public function readRequest($object_type, $batch_read_input_simple_public_object } /** - * Operation update + * Operation read * - * Update a batch of objects by internal ID, or unique property values + * Read a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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\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 update($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + public function read($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->updateWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, $contentType); + list($response) = $this->readWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation readWithHttpInfo * - * Update a batch of objects by internal ID, or unique property values + * Read a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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\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 updateWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + public function readWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->updateRequest($object_type, $batch_input_simple_public_object_batch_input, $contentType); + $request = $this->readRequest($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1083,10 +1069,10 @@ public function updateWithHttpInfo($object_type, $batch_input_simple_public_obje throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1173,20 +1159,21 @@ public function updateWithHttpInfo($object_type, $batch_input_simple_public_obje } /** - * Operation updateAsync + * Operation readAsync * - * Update a batch of objects by internal ID, or unique property values + * Read a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 updateAsync($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + public function readAsync($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->updateAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, $contentType) + return $this->readAsyncWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1195,21 +1182,22 @@ function ($response) { } /** - * Operation updateAsyncWithHttpInfo + * Operation readAsyncWithHttpInfo * - * Update a batch of objects by internal ID, or unique property values + * Read a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 updateAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + public function readAsyncWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($object_type, $batch_input_simple_public_object_batch_input, $contentType); + $request = $this->readRequest($object_type, $batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1231,8 +1219,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -1240,48 +1228,59 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); } /** - * Create request for operation 'update' + * Create request for operation 'read' * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 updateRequest($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + public function readRequest($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { // verify the required parameter 'object_type' is set if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' + 'Missing the required parameter $object_type when calling read' ); } - // 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)) { + // 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_input_simple_public_object_batch_input when calling update' + 'Missing the required parameter $batch_read_input_simple_public_object_id when calling read' ); } - $resourcePath = '/crm/v3/objects/{objectType}/batch/update'; + + $resourcePath = '/crm/v3/objects/{objectType}/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 + ) ?? []); // path params @@ -1301,12 +1300,12 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba ); // for model (json/xml) - if (isset($batch_input_simple_public_object_batch_input)) { + 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_input_simple_public_object_batch_input)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { - $httpBody = $batch_input_simple_public_object_batch_input; + $httpBody = $batch_read_input_simple_public_object_id; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1325,7 +1324,7 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1359,40 +1358,40 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba } /** - * Operation upsert + * Operation update * - * Create or update a batch of objects by unique property values + * Update a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ - public function upsert($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + public function update($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->upsertWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); + list($response) = $this->updateWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, $contentType); return $response; } /** - * Operation upsertWithHttpInfo + * Operation updateWithHttpInfo * - * Create or update a batch of objects by unique property values + * Update a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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\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\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @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 upsertWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + public function updateWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->upsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); + $request = $this->updateRequest($object_type, $batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1402,10 +1401,10 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1420,13 +1419,13 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje switch($statusCode) { case 200: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', $request, $response, ); case 207: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', $request, $response, ); @@ -1454,7 +1453,7 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje } return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', $request, $response, ); @@ -1463,7 +1462,7 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1471,7 +1470,7 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje case 207: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1492,20 +1491,20 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje } /** - * Operation upsertAsync + * Operation updateAsync * - * Create or update a batch of objects by unique property values + * Update a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 upsertAsync($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + public function updateAsync($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->upsertAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType) + return $this->updateAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1514,21 +1513,21 @@ function ($response) { } /** - * Operation upsertAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Create or update a batch of objects by unique property values + * Update a batch of objects by internal ID, or unique property values * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 upsertAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + public function updateAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject'; - $request = $this->upsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, $contentType); + $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; + $request = $this->updateRequest($object_type, $batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1550,8 +1549,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -1559,42 +1558,42 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); } /** - * Create request for operation 'upsert' + * Create request for operation 'update' * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\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 + * @param \HubSpot\Client\Crm\Objects\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 upsertRequest($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + public function updateRequest($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'object_type' is set if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling upsert' + 'Missing the required parameter $object_type when calling update' ); } - // 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)) { + // 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_upsert when calling upsert' + 'Missing the required parameter $batch_input_simple_public_object_batch_input when calling update' ); } - $resourcePath = '/crm/v3/objects/{objectType}/batch/upsert'; + $resourcePath = '/crm/v3/objects/{objectType}/batch/update'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1620,12 +1619,12 @@ public function upsertRequest($object_type, $batch_input_simple_public_object_ba ); // for model (json/xml) - if (isset($batch_input_simple_public_object_batch_input_upsert)) { + 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_upsert)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { - $httpBody = $batch_input_simple_public_object_batch_input_upsert; + $httpBody = $batch_input_simple_public_object_batch_input; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1644,7 +1643,7 @@ public function upsertRequest($object_type, $batch_input_simple_public_object_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/SearchApi.php b/codegen/Crm/Objects/Api/SearchApi.php index a0fd758f..cdb64be6 100644 --- a/codegen/Crm/Objects/Api/SearchApi.php +++ b/codegen/Crm/Objects/Api/SearchApi.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -29,7 +29,6 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; @@ -128,6 +127,8 @@ public function getConfig() /** * Operation doSearch * + * Search for CRM objects of a specified type. + * * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\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 @@ -145,6 +146,8 @@ public function doSearch($object_type, $public_object_search_request, string $co /** * Operation doSearchWithHttpInfo * + * Search for CRM objects of a specified type. + * * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\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 @@ -165,10 +168,10 @@ public function doSearchWithHttpInfo($object_type, $public_object_search_request throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + (method_exists($e, 'getResponse') && $e->getResponse()) ? $e->getResponse()->getHeaders() : null, + (method_exists($e, 'getResponse') && $e->getResponse()) ? (string) $e->getResponse()->getBody() : null ); - } catch (ConnectException $e) { + } catch (\Psr\Http\Client\NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -243,6 +246,8 @@ public function doSearchWithHttpInfo($object_type, $public_object_search_request /** * Operation doSearchAsync * + * Search for CRM objects of a specified type. + * * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\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 @@ -263,6 +268,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for CRM objects of a specified type. + * * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\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 @@ -295,8 +302,8 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); + $response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + $statusCode = $response ? $response->getStatusCode() : $exception->getCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -304,8 +311,8 @@ function ($exception) { $exception->getRequest()->getUri() ), $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response ? $response->getHeaders() : [], + $response ? (string) $response->getBody() : '' ); } ); @@ -368,7 +375,7 @@ public function doSearchRequest($object_type, $public_object_search_request, str if (isset($public_object_search_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_object_search_request)); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -389,7 +396,7 @@ public function doSearchRequest($object_type, $public_object_search_request, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/ApiException.php b/codegen/Crm/Objects/ApiException.php index f1e27fc9..b63ab73f 100644 --- a/codegen/Crm/Objects/ApiException.php +++ b/codegen/Crm/Objects/ApiException.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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 f22182f7..c6ce36da 100644 --- a/codegen/Crm/Objects/Calls/Api/BasicApi.php +++ b/codegen/Crm/Objects/Calls/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($call_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($call_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($call_id, $simple_public_object_input, $id_propert 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($call_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Calls/Api/BatchApi.php b/codegen/Crm/Objects/Calls/Api/BatchApi.php index 6d8d8465..d6f40100 100644 --- a/codegen/Crm/Objects/Calls/Api/BatchApi.php +++ b/codegen/Crm/Objects/Calls/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Calls/Api/SearchApi.php b/codegen/Crm/Objects/Calls/Api/SearchApi.php index 624ce9b9..00f0fd93 100644 --- a/codegen/Crm/Objects/Calls/Api/SearchApi.php +++ b/codegen/Crm/Objects/Calls/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Calls/Model/AssociatedId.php b/codegen/Crm/Objects/Calls/Model/AssociatedId.php index f24712e1..3f942494 100644 --- a/codegen/Crm/Objects/Calls/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Calls/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/AssociationSpec.php b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php index f7be2f72..b5f655fe 100644 --- a/codegen/Crm/Objects/Calls/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php index 82a3d40f..86db669d 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php index 61ac9dee..c0192187 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php index d156e49c..838fd5fd 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 8c3dd92e..00000000 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Calls\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Calls\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\Paging|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\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObject.php index d4666047..73ace6e4 100644 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php index 7683e6a9..22418ce4 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php index 6e1c3ce6..f12c39f7 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php index 68fa997d..cc315b08 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Calls * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php index ecef366a..6485ba4e 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php index f851fa39..b63cbdc5 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/StandardError.php b/codegen/Crm/Objects/Calls/Model/StandardError.php index 0dc53dc9..4748c46e 100644 --- a/codegen/Crm/Objects/Calls/Model/StandardError.php +++ b/codegen/Crm/Objects/Calls/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php index 975f6a67..340cedf0 100644 --- a/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Api/BasicApi.php b/codegen/Crm/Objects/Communications/Api/BasicApi.php index 2054c503..7d13c46b 100644 --- a/codegen/Crm/Objects/Communications/Api/BasicApi.php +++ b/codegen/Crm/Objects/Communications/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($communication_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($communication_id, $archived = false, $associatio } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($communication_id, $simple_public_object_input, $i 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($communication_id, $simple_public_object_input, $i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Communications/Api/BatchApi.php b/codegen/Crm/Objects/Communications/Api/BatchApi.php index dd6ea1a0..a5d2f132 100644 --- a/codegen/Crm/Objects/Communications/Api/BatchApi.php +++ b/codegen/Crm/Objects/Communications/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Communications/Api/SearchApi.php b/codegen/Crm/Objects/Communications/Api/SearchApi.php index 9980436b..a0b4550b 100644 --- a/codegen/Crm/Objects/Communications/Api/SearchApi.php +++ b/codegen/Crm/Objects/Communications/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Communications/Model/AssociatedId.php b/codegen/Crm/Objects/Communications/Model/AssociatedId.php index 19a4ce49..602427d3 100644 --- a/codegen/Crm/Objects/Communications/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Communications/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/AssociationSpec.php b/codegen/Crm/Objects/Communications/Model/AssociationSpec.php index 88e7c728..26812b4f 100644 --- a/codegen/Crm/Objects/Communications/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Communications/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php index b3453164..bc1bb552 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php index 44cf037e..37e4434d 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php index d6d82c0c..e0ef1581 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObject.php index c92e7a73..a8e9f9de 100644 --- a/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php index 4147c137..fe240cbe 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php index 70bca9c0..a50f2fb0 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php index c1609c2e..3d24bf84 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Communications * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php index 46da61b8..0a060586 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php index 1e2f50ac..5877b5b4 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/StandardError.php b/codegen/Crm/Objects/Communications/Model/StandardError.php index e229eddb..f0f9fd36 100644 --- a/codegen/Crm/Objects/Communications/Model/StandardError.php +++ b/codegen/Crm/Objects/Communications/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php index 1db746ac..ccdf61ce 100644 --- a/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Configuration.php b/codegen/Crm/Objects/Configuration.php index c3891630..41a3f520 100644 --- a/codegen/Crm/Objects/Configuration.php +++ b/codegen/Crm/Objects/Configuration.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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/DealSplits/Api/BatchApi.php b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php index c0ca7593..7724d7be 100644 --- a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php +++ b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php @@ -372,7 +372,7 @@ public function crmObjectsV3DealsSplitsBatchReadRequest($batch_input_public_obje if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -393,7 +393,7 @@ public function crmObjectsV3DealsSplitsBatchReadRequest($batch_input_public_obje } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -671,7 +671,7 @@ public function crmObjectsV3DealsSplitsBatchUpsertRequest($public_deal_splits_ba if (isset($public_deal_splits_batch_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_deal_splits_batch_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_deal_splits_batch_create_request; } @@ -692,7 +692,7 @@ public function crmObjectsV3DealsSplitsBatchUpsertRequest($public_deal_splits_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php index 3c768017..0ce392c0 100644 --- a/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/DealSplits/Model/SimplePublicObject.php @@ -482,7 +482,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -536,7 +536,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php index 68cbd44f..2a507bd1 100644 --- a/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/DealSplits/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Api/BasicApi.php b/codegen/Crm/Objects/Emails/Api/BasicApi.php index fc91fbe1..eb45908e 100644 --- a/codegen/Crm/Objects/Emails/Api/BasicApi.php +++ b/codegen/Crm/Objects/Emails/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($email_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($email_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Emails/Api/BatchApi.php b/codegen/Crm/Objects/Emails/Api/BatchApi.php index d039a8ef..d914e2d8 100644 --- a/codegen/Crm/Objects/Emails/Api/BatchApi.php +++ b/codegen/Crm/Objects/Emails/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Emails/Api/SearchApi.php b/codegen/Crm/Objects/Emails/Api/SearchApi.php index 569800cb..34250807 100644 --- a/codegen/Crm/Objects/Emails/Api/SearchApi.php +++ b/codegen/Crm/Objects/Emails/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Emails/Model/AssociatedId.php b/codegen/Crm/Objects/Emails/Model/AssociatedId.php index 4adf0538..bb812bff 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Emails/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php index 7e18bec6..22aa8ce4 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php index f90d8e38..7949cdb3 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php index 0affccdc..eb99c206 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php index 14547923..0ecd9929 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index d074c6ea..00000000 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Emails\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Emails\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\Paging|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\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObject.php index 46a06bd6..6f666882 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php index b6b4365e..bc8ba8d3 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php index a2ed6430..604af6c8 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php index e91142e7..a2cc233d 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Emails * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php index 422dfcce..33a66400 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php index eed03636..2396c48b 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/StandardError.php b/codegen/Crm/Objects/Emails/Model/StandardError.php index 2b3b675b..775903c5 100644 --- a/codegen/Crm/Objects/Emails/Model/StandardError.php +++ b/codegen/Crm/Objects/Emails/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php index 3b30870c..099aeaab 100644 --- a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php index de4ed497..fa9fcb50 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php @@ -458,17 +458,13 @@ public function getByIdRequest($feedback_submission_id, $archived = false, $asso } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -814,17 +810,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php index 9714cd34..b4e8cc04 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php @@ -384,7 +384,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -405,17 +405,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php index d3d24dfe..d9608d15 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php index 60dd9186..82822adb 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php index 6e7fc97c..5e4b132e 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php index ed92da1f..bf1b7e17 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index fe6b5b58..00000000 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\FeedbackSubmissions\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Paging|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\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObject.php index c853e4fd..37f96bb0 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php index feba34b6..83b480dc 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php @@ -489,7 +489,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -543,7 +543,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php index 99454360..7725df6b 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php @@ -442,7 +442,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -631,7 +631,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php index 1329a81e..acb23ec8 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php index d555983e..69d711f8 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/FormDataProcessor.php b/codegen/Crm/Objects/FormDataProcessor.php index 18cd3bc7..7545c8dd 100644 --- a/codegen/Crm/Objects/FormDataProcessor.php +++ b/codegen/Crm/Objects/FormDataProcessor.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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/Goals/Api/BasicApi.php b/codegen/Crm/Objects/Goals/Api/BasicApi.php index 128721e5..a8a5787f 100644 --- a/codegen/Crm/Objects/Goals/Api/BasicApi.php +++ b/codegen/Crm/Objects/Goals/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($goal_target_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($goal_target_id, $archived = false, $associations } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($goal_target_id, $simple_public_object_input, $id_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($goal_target_id, $simple_public_object_input, $id_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Goals/Api/BatchApi.php b/codegen/Crm/Objects/Goals/Api/BatchApi.php index 3c75e6e3..0376a362 100644 --- a/codegen/Crm/Objects/Goals/Api/BatchApi.php +++ b/codegen/Crm/Objects/Goals/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Goals/Api/SearchApi.php b/codegen/Crm/Objects/Goals/Api/SearchApi.php index 15355913..61d2b179 100644 --- a/codegen/Crm/Objects/Goals/Api/SearchApi.php +++ b/codegen/Crm/Objects/Goals/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Goals/Model/AssociatedId.php b/codegen/Crm/Objects/Goals/Model/AssociatedId.php index 4b56afc4..5dd60f25 100644 --- a/codegen/Crm/Objects/Goals/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Goals/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/AssociationSpec.php b/codegen/Crm/Objects/Goals/Model/AssociationSpec.php index e3badabd..b7ceef7d 100644 --- a/codegen/Crm/Objects/Goals/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Goals/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php index 37192061..ec74e1f9 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php index ed90f9ef..1a9a606c 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php index 655f1719..62108a47 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 264a69bd..00000000 --- a/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Goals\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Goals\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\Paging|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\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObject.php index f16d6795..6ff0e1ec 100644 --- a/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php index eb272f9d..ccad0fb9 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php index dde1b2ac..72e95b79 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php index f6b7e025..54c2a6a3 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Goals * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php index fce2c4c6..891976ad 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php index 4c821bfc..2436a86a 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/StandardError.php b/codegen/Crm/Objects/Goals/Model/StandardError.php index 47c5f1a3..83b1435d 100644 --- a/codegen/Crm/Objects/Goals/Model/StandardError.php +++ b/codegen/Crm/Objects/Goals/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php index 8465b72f..0ca23c4d 100644 --- a/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/HeaderSelector.php b/codegen/Crm/Objects/HeaderSelector.php index ab4f14a7..2246e21c 100644 --- a/codegen/Crm/Objects/HeaderSelector.php +++ b/codegen/Crm/Objects/HeaderSelector.php @@ -10,7 +10,7 @@ */ /** - * CRM Objects + * Custom 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 2c4da7d0..8d65d545 100644 --- a/codegen/Crm/Objects/Leads/Api/BasicApi.php +++ b/codegen/Crm/Objects/Leads/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($leads_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($leads_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($leads_id, $simple_public_object_input, $id_proper 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($leads_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Leads/Api/BatchApi.php b/codegen/Crm/Objects/Leads/Api/BatchApi.php index 0a9ff081..d4d3b7d7 100644 --- a/codegen/Crm/Objects/Leads/Api/BatchApi.php +++ b/codegen/Crm/Objects/Leads/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Leads/Api/SearchApi.php b/codegen/Crm/Objects/Leads/Api/SearchApi.php index 4f3634e8..e39c8ef8 100644 --- a/codegen/Crm/Objects/Leads/Api/SearchApi.php +++ b/codegen/Crm/Objects/Leads/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Leads/Model/AssociatedId.php b/codegen/Crm/Objects/Leads/Model/AssociatedId.php index f58639bf..67db0396 100644 --- a/codegen/Crm/Objects/Leads/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Leads/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/AssociationSpec.php b/codegen/Crm/Objects/Leads/Model/AssociationSpec.php index a3f4ec07..5e233900 100644 --- a/codegen/Crm/Objects/Leads/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Leads/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php index ea1e0bc1..f083199f 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php index 6d748ba2..d2a32e54 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php index d4259df1..a90e9525 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObject.php index 0f3b46b3..2c8ce86c 100644 --- a/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php index 4fda9e53..f98d955a 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php index 27c6287b..ff9b97e6 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php index 4b70a5fa..17dc548a 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Leads * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php index 94eac436..12777a8f 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php index a9233c00..d9d60aae 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/StandardError.php b/codegen/Crm/Objects/Leads/Model/StandardError.php index 812356a8..23c21974 100644 --- a/codegen/Crm/Objects/Leads/Model/StandardError.php +++ b/codegen/Crm/Objects/Leads/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php index 1acce9d8..0a975556 100644 --- a/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Api/BasicApi.php b/codegen/Crm/Objects/Meetings/Api/BasicApi.php index 2d33fe79..e689d86b 100644 --- a/codegen/Crm/Objects/Meetings/Api/BasicApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($meeting_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($meeting_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Meetings/Api/BatchApi.php b/codegen/Crm/Objects/Meetings/Api/BatchApi.php index 803ecb6d..8f1bf07c 100644 --- a/codegen/Crm/Objects/Meetings/Api/BatchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Meetings/Api/SearchApi.php b/codegen/Crm/Objects/Meetings/Api/SearchApi.php index 6e87102d..981b6cff 100644 --- a/codegen/Crm/Objects/Meetings/Api/SearchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/SearchApi.php @@ -347,7 +347,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -368,17 +368,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php index 398b379c..0b50273c 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php index 7f8a5020..76006cd2 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php index 12f8f557..e5ba2bca 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php index c747b1ad..ee3659ae 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php index e3aae092..83752674 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index a8dfa961..00000000 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Meetings\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Meetings\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\Paging|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\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObject.php index 26b8ec2c..3bb4b2b7 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php index d132bb4b..b82765c8 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php index 5244f742..3fde1e3e 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php index a1d5c60c..dae3a385 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Meetings * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php index f7df410f..c5a71c9f 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php index 0cba6369..e0f08d5d 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/StandardError.php b/codegen/Crm/Objects/Meetings/Model/StandardError.php index 3bbf14f4..2d385634 100644 --- a/codegen/Crm/Objects/Meetings/Model/StandardError.php +++ b/codegen/Crm/Objects/Meetings/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php index d5879fe0..f85f0712 100644 --- a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Model/AssociatedId.php b/codegen/Crm/Objects/Model/AssociatedId.php index 21561591..255a02cf 100644 --- a/codegen/Crm/Objects/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Model/AssociatedId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ @@ -343,7 +343,7 @@ public function getType() /** * Sets type * - * @param string $type The type of association. + * @param string $type The type of associations. * * @return self */ diff --git a/codegen/Crm/Objects/Model/AssociationSpec.php b/codegen/Crm/Objects/Model/AssociationSpec.php index 620150d9..b07e9d50 100644 --- a/codegen/Crm/Objects/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Model/AssociationSpec.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php index 734726fa..3915931b 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * BatchInputSimplePublicObjectBatchInput Class Doc Comment * * @category Class + * @description Represents a batch input component used to handle multiple simple public objects in a single API request. This component is typically used when performing batch operations to create, update, or delete multiple records simultaneously. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -305,7 +306,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[] $inputs An array of simple public objects to be processed in the batch operation. Each object in the array contains the data necessary for the specific operation being performed. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 9d942b29..f76b5c40 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * BatchInputSimplePublicObjectBatchInputForCreate Class Doc Comment * * @category Class + * @description Represents a batch input for creating multiple simple public objects in a single request. This component is used to streamline the process of adding new objects to a HubSpot account by allowing multiple entries to be created at once. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -305,7 +306,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputForCreate[] $inputs An array of simple public objects to be created. Each object in the array contains the necessary data for creating a new entry in the system. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 26872f4d..058c7ab8 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * BatchInputSimplePublicObjectBatchInputUpsert Class Doc Comment * * @category Class + * @description Represents a batch input operation for upserting simple public objects in HubSpot. This component is used to process multiple upsert operations in a single request, improving efficiency and performance. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -305,7 +306,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputUpsert[] $inputs An array of simple public objects to be upserted. Each object in the array contains the necessary data for creating or updating a record in HubSpot. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php index 621f2752..4db698b8 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * BatchInputSimplePublicObjectId Class Doc Comment * * @category Class + * @description Represents a batch input payload containing a list of simple public object IDs. This component is used when performing batch operations on multiple objects within HubSpot. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -305,7 +306,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs An array of simple public object IDs to be processed in the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php index 281aa3e1..c80bc6e0 100644 --- a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php index c4e8b344..637a7ebc 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ @@ -513,7 +513,7 @@ public function getStatus() /** * Sets status * - * @param string $status The status of the batch processing request. Expected value is \"COMPLETE\". + * @param string $status The status of the batch processing request. The expected value is \"COMPLETE\". * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php index 378350a7..68290ce2 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 5313fe91..5cd0d6eb 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ @@ -513,7 +513,7 @@ public function getStatus() /** * Sets status * - * @param string $status The status of the batch processing request. Expected value is \"COMPLETE\". + * @param string $status The status of the batch processing request. The expected value is \"COMPLETE\". * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 2a13d6f6..04338a6b 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 4c825e24..40fd240a 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * CollectionResponseAssociatedId Class Doc Comment * * @category Class + * @description Represents a collection of associated IDs returned by an API request, including pagination details for navigating through the results. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -339,7 +340,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Model\AssociatedId[] $results A list of associated IDs retrieved from the API request. * * @return self */ diff --git a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 2091e831..028c2474 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * CollectionResponseSimplePublicObjectWithAssociationsForwardPaging Class Doc Comment * * @category Class + * @description Represents a paginated collection response that includes simple public objects with their associations. This component is used to handle the results and pagination details when retrieving a list of objects from the API. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -339,7 +340,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations[] $results results + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations[] $results An array of simple public objects that are included in the current page of the response. Each object may include its associated data. * * @return self */ diff --git a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php index 23cddbca..2b6fc1b1 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Model/Error.php b/codegen/Crm/Objects/Model/Error.php index a8032a46..8de092c8 100644 --- a/codegen/Crm/Objects/Model/Error.php +++ b/codegen/Crm/Objects/Model/Error.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * Error Class Doc Comment * * @category Class + * @description Represents an error response returned by the API when an operation fails. This component is used in various endpoints to provide detailed information about the error encountered. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Model/ErrorDetail.php b/codegen/Crm/Objects/Model/ErrorDetail.php index 375fda6b..e8afc3cc 100644 --- a/codegen/Crm/Objects/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Model/ErrorDetail.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * ErrorDetail Class Doc Comment * * @category Class + * @description Represents detailed information about an error that occurred in the API. This component is used to provide additional context and specifics about errors, typically as part of an error response. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Model/Filter.php b/codegen/Crm/Objects/Model/Filter.php index 9ac2ed52..02a9a35a 100644 --- a/codegen/Crm/Objects/Model/Filter.php +++ b/codegen/Crm/Objects/Model/Filter.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -410,7 +410,7 @@ public function getOperator() /** * Sets operator * - * @param string $operator null + * @param string $operator The comparison operator used in the filter, such as \"EQ\" or \"GT\". * * @return self */ diff --git a/codegen/Crm/Objects/Model/FilterGroup.php b/codegen/Crm/Objects/Model/FilterGroup.php index bdaf81a0..49e9083e 100644 --- a/codegen/Crm/Objects/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Model/FilterGroup.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * FilterGroup Class Doc Comment * * @category Class + * @description Represents a group of filters used to query data within HubSpot. This component is used to define criteria for filtering records in various API endpoints. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -305,7 +306,7 @@ public function getFilters() /** * Sets filters * - * @param \HubSpot\Client\Crm\Objects\Model\Filter[] $filters filters + * @param \HubSpot\Client\Crm\Objects\Model\Filter[] $filters A list of individual filter criteria that are applied together as a group. Each filter specifies a condition that records must meet to be included in the results. * * @return self */ diff --git a/codegen/Crm/Objects/Model/ForwardPaging.php b/codegen/Crm/Objects/Model/ForwardPaging.php index c27757b9..9f36edbb 100644 --- a/codegen/Crm/Objects/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Model/ForwardPaging.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * ForwardPaging Class Doc Comment * * @category Class + * @description Paging information for forward-only pagination. Contains the next page reference when more results are available; omitted or empty on the last page. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Model/ModelInterface.php b/codegen/Crm/Objects/Model/ModelInterface.php index 72c8dfeb..179bdec4 100644 --- a/codegen/Crm/Objects/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Model/ModelInterface.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 627d7add..e87f7bd1 100644 --- a/codegen/Crm/Objects/Model/NextPage.php +++ b/codegen/Crm/Objects/Model/NextPage.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 6cb1657b..d8b9c9cb 100644 --- a/codegen/Crm/Objects/Model/Paging.php +++ b/codegen/Crm/Objects/Model/Paging.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * Paging Class Doc Comment * * @category Class + * @description Represents the pagination information for navigating through a list of results in the API. It provides details on how to access the previous or next set of results. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Model/PreviousPage.php b/codegen/Crm/Objects/Model/PreviousPage.php index 0f9d6a64..5a080a40 100644 --- a/codegen/Crm/Objects/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Model/PreviousPage.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 8bd092a5..3021bf71 100644 --- a/codegen/Crm/Objects/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Model/PublicAssociationsForObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,6 +35,7 @@ * PublicAssociationsForObject Class Doc Comment * * @category Class + * @description Represents the associations for a specific object in HubSpot, detailing the types of associations and the related objects involved. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -342,7 +343,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Objects\Model\AssociationSpec[] $types types + * @param \HubSpot\Client\Crm\Objects\Model\AssociationSpec[] $types The types of associations that exist between the object and other entities, indicating the nature of their relationship. * * @return self */ diff --git a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/PublicMergeInput.php similarity index 79% rename from codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociations.php rename to codegen/Crm/Objects/Model/PublicMergeInput.php index a882529d..6b743912 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/PublicMergeInput.php @@ -1,17 +1,17 @@ */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +50,7 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * * @var string */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; + protected static $openAPIModelName = 'PublicMergeInput'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,8 +58,8 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @var string[] */ protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Deals\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations[]' + 'object_id_to_merge' => 'string', + 'primary_object_id' => 'string' ]; /** @@ -69,8 +70,8 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @psalm-var array */ protected static $openAPIFormats = [ - 'paging' => null, - 'results' => null + 'object_id_to_merge' => null, + 'primary_object_id' => null ]; /** @@ -79,8 +80,8 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @var boolean[] */ protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false + 'object_id_to_merge' => false, + 'primary_object_id' => false ]; /** @@ -169,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'paging' => 'paging', - 'results' => 'results' + 'object_id_to_merge' => 'objectIdToMerge', + 'primary_object_id' => 'primaryObjectId' ]; /** @@ -179,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults' + 'object_id_to_merge' => 'setObjectIdToMerge', + 'primary_object_id' => 'setPrimaryObjectId' ]; /** @@ -189,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults' + 'object_id_to_merge' => 'getObjectIdToMerge', + 'primary_object_id' => 'getPrimaryObjectId' ]; /** @@ -250,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('paging', $data ?? [], null); - $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); } /** @@ -281,8 +282,11 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['results'] === null) { - $invalidProperties[] = "'results' can't be null"; + if ($this->container['object_id_to_merge'] === null) { + $invalidProperties[] = "'object_id_to_merge' can't be null"; + } + if ($this->container['primary_object_id'] === null) { + $invalidProperties[] = "'primary_object_id' can't be null"; } return $invalidProperties; } @@ -300,55 +304,55 @@ public function valid() /** - * Gets paging + * Gets object_id_to_merge * - * @return \HubSpot\Client\Crm\Deals\Model\Paging|null + * @return string */ - public function getPaging() + public function getObjectIdToMerge() { - return $this->container['paging']; + return $this->container['object_id_to_merge']; } /** - * Sets paging + * Sets object_id_to_merge * - * @param \HubSpot\Client\Crm\Deals\Model\Paging|null $paging paging + * @param string $object_id_to_merge The ID of the object that will be merged into the primary object. * * @return self */ - public function setPaging($paging) + public function setObjectIdToMerge($object_id_to_merge) { - if (is_null($paging)) { - throw new \InvalidArgumentException('non-nullable paging cannot be null'); + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); } - $this->container['paging'] = $paging; + $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; } /** - * Gets results + * Gets primary_object_id * - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations[] + * @return string */ - public function getResults() + public function getPrimaryObjectId() { - return $this->container['results']; + return $this->container['primary_object_id']; } /** - * Sets results + * Sets primary_object_id * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations[] $results results + * @param string $primary_object_id The ID of the primary object into which another object will be merged. * * @return self */ - public function setResults($results) + public function setPrimaryObjectId($primary_object_id) { - if (is_null($results)) { - throw new \InvalidArgumentException('non-nullable results cannot be null'); + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); } - $this->container['results'] = $results; + $this->container['primary_object_id'] = $primary_object_id; return $this; } diff --git a/codegen/Crm/Objects/Model/PublicObjectId.php b/codegen/Crm/Objects/Model/PublicObjectId.php index 7cabf9f7..a5c71b15 100644 --- a/codegen/Crm/Objects/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Model/PublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 ece9026d..056a21d3 100644 --- a/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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/Communications/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/PublicObjectWarning.php similarity index 75% rename from codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociations.php rename to codegen/Crm/Objects/Model/PublicObjectWarning.php index 0db86d56..87c58218 100644 --- a/codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/PublicObjectWarning.php @@ -1,17 +1,17 @@ */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +class PublicObjectWarning implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +50,7 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * * @var string */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; + protected static $openAPIModelName = 'PublicObjectWarning'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,8 +58,9 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @var string[] */ protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Communications\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectWithAssociations[]' + 'category' => 'string', + 'context' => 'array', + 'message' => 'string' ]; /** @@ -69,8 +71,9 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @psalm-var array */ protected static $openAPIFormats = [ - 'paging' => null, - 'results' => null + 'category' => null, + 'context' => null, + 'message' => null ]; /** @@ -79,8 +82,9 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @var boolean[] */ protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false + 'category' => false, + 'context' => false, + 'message' => false ]; /** @@ -169,8 +173,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'paging' => 'paging', - 'results' => 'results' + 'category' => 'category', + 'context' => 'context', + 'message' => 'message' ]; /** @@ -179,8 +184,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults' + 'category' => 'setCategory', + 'context' => 'setContext', + 'message' => 'setMessage' ]; /** @@ -189,8 +195,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults' + 'category' => 'getCategory', + 'context' => 'getContext', + 'message' => 'getMessage' ]; /** @@ -250,8 +257,9 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('paging', $data ?? [], null); - $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); } /** @@ -281,8 +289,14 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['results'] === null) { - $invalidProperties[] = "'results' can't be null"; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' 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"; } return $invalidProperties; } @@ -300,55 +314,82 @@ public function valid() /** - * Gets paging + * Gets category * - * @return \HubSpot\Client\Crm\Objects\Communications\Model\Paging|null + * @return string */ - public function getPaging() + public function getCategory() { - return $this->container['paging']; + return $this->container['category']; } /** - * Sets paging + * Sets category * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\Paging|null $paging paging + * @param string $category The classification of the warning, indicating the type or nature of the issue. * * @return self */ - public function setPaging($paging) + public function setCategory($category) { - if (is_null($paging)) { - throw new \InvalidArgumentException('non-nullable paging cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['paging'] = $paging; + $this->container['category'] = $category; return $this; } /** - * Gets results + * Gets context * - * @return \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectWithAssociations[] + * @return array + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array $context Additional information or metadata about the warning, providing context for understanding the issue. + * + * @return self + */ + public function setContext($context) + { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets message + * + * @return string */ - public function getResults() + public function getMessage() { - return $this->container['results']; + return $this->container['message']; } /** - * Sets results + * Sets message * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectWithAssociations[] $results results + * @param string $message The text of the warning message, providing information about the issue or alert. * * @return self */ - public function setResults($results) + public function setMessage($message) { - if (is_null($results)) { - throw new \InvalidArgumentException('non-nullable results cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['results'] = $results; + $this->container['message'] = $message; return $this; } diff --git a/codegen/Crm/Objects/Model/SimplePublicObject.php b/codegen/Crm/Objects/Model/SimplePublicObject.php index 72d4b06a..43783531 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -66,7 +66,8 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'properties' => 'array', 'properties_with_history' => 'array', 'updated_at' => '\DateTime', - 'url' => 'string' + 'url' => 'string', + 'warnings' => '\HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]' ]; /** @@ -85,7 +86,8 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'properties' => null, 'properties_with_history' => null, 'updated_at' => 'date-time', - 'url' => null + 'url' => null, + 'warnings' => null ]; /** @@ -102,7 +104,8 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'properties' => false, 'properties_with_history' => false, 'updated_at' => false, - 'url' => false + 'url' => false, + 'warnings' => false ]; /** @@ -199,7 +202,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'properties', 'properties_with_history' => 'propertiesWithHistory', 'updated_at' => 'updatedAt', - 'url' => 'url' + 'url' => 'url', + 'warnings' => 'warnings' ]; /** @@ -216,7 +220,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'setProperties', 'properties_with_history' => 'setPropertiesWithHistory', 'updated_at' => 'setUpdatedAt', - 'url' => 'setUrl' + 'url' => 'setUrl', + 'warnings' => 'setWarnings' ]; /** @@ -233,7 +238,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'getProperties', 'properties_with_history' => 'getPropertiesWithHistory', 'updated_at' => 'getUpdatedAt', - 'url' => 'getUrl' + 'url' => 'getUrl', + 'warnings' => 'getWarnings' ]; /** @@ -302,6 +308,7 @@ public function __construct(?array $data = null) $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } /** @@ -479,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -533,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ @@ -587,7 +594,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url Direct URL for this object in the portal + * @param string|null $url The URL associated with the object. * * @return self */ @@ -600,6 +607,33 @@ public function setUrl($url) return $this; } + + /** + * Gets warnings + * + * @return \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null + */ + public function getWarnings() + { + return $this->container['warnings']; + } + + /** + * Sets warnings + * + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null $warnings warnings + * + * @return self + */ + public function setWarnings($warnings) + { + if (is_null($warnings)) { + throw new \InvalidArgumentException('non-nullable warnings cannot be null'); + } + $this->container['warnings'] = $warnings; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php index eb93c7a1..a3b9c6d4 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 index fec3834b..22413ce5 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputForCreate.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php index e779ce60..023f55f2 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 b38cd365..9df52049 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 e8077195..6beec654 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectInput.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php index c1d5dfaa..73c8e31a 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php index b58bdd07..6944a7b8 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -67,7 +67,8 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'properties' => 'array', 'properties_with_history' => 'array', 'updated_at' => '\DateTime', - 'url' => 'string' + 'url' => 'string', + 'warnings' => '\HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]' ]; /** @@ -87,7 +88,8 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'properties' => null, 'properties_with_history' => null, 'updated_at' => 'date-time', - 'url' => null + 'url' => null, + 'warnings' => null ]; /** @@ -105,7 +107,8 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'properties' => false, 'properties_with_history' => false, 'updated_at' => false, - 'url' => false + 'url' => false, + 'warnings' => false ]; /** @@ -203,7 +206,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'properties', 'properties_with_history' => 'propertiesWithHistory', 'updated_at' => 'updatedAt', - 'url' => 'url' + 'url' => 'url', + 'warnings' => 'warnings' ]; /** @@ -221,7 +225,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'setProperties', 'properties_with_history' => 'setPropertiesWithHistory', 'updated_at' => 'setUpdatedAt', - 'url' => 'setUrl' + 'url' => 'setUrl', + 'warnings' => 'setWarnings' ]; /** @@ -239,7 +244,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'getProperties', 'properties_with_history' => 'getPropertiesWithHistory', 'updated_at' => 'getUpdatedAt', - 'url' => 'getUrl' + 'url' => 'getUrl', + 'warnings' => 'getWarnings' ]; /** @@ -309,6 +315,7 @@ public function __construct(?array $data = null) $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } /** @@ -432,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -621,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url Direct URL for this object in HubSpot + * @param string|null $url The URL link to access this object. * * @return self */ @@ -634,6 +641,33 @@ public function setUrl($url) return $this; } + + /** + * Gets warnings + * + * @return \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null + */ + public function getWarnings() + { + return $this->container['warnings']; + } + + /** + * Sets warnings + * + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null $warnings warnings + * + * @return self + */ + public function setWarnings($warnings) + { + if (is_null($warnings)) { + throw new \InvalidArgumentException('non-nullable warnings cannot be null'); + } + $this->container['warnings'] = $warnings; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php index 6729f7ac..8021c010 100644 --- a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -67,7 +67,8 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'properties' => 'array', 'properties_with_history' => 'array', 'updated_at' => '\DateTime', - 'url' => 'string' + 'url' => 'string', + 'warnings' => '\HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]' ]; /** @@ -87,7 +88,8 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'properties' => null, 'properties_with_history' => null, 'updated_at' => 'date-time', - 'url' => null + 'url' => null, + 'warnings' => null ]; /** @@ -105,7 +107,8 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'properties' => false, 'properties_with_history' => false, 'updated_at' => false, - 'url' => false + 'url' => false, + 'warnings' => false ]; /** @@ -203,7 +206,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'properties', 'properties_with_history' => 'propertiesWithHistory', 'updated_at' => 'updatedAt', - 'url' => 'url' + 'url' => 'url', + 'warnings' => 'warnings' ]; /** @@ -221,7 +225,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'setProperties', 'properties_with_history' => 'setPropertiesWithHistory', 'updated_at' => 'setUpdatedAt', - 'url' => 'setUrl' + 'url' => 'setUrl', + 'warnings' => 'setWarnings' ]; /** @@ -239,7 +244,8 @@ public function isNullableSetToNull(string $property): bool 'properties' => 'getProperties', 'properties_with_history' => 'getPropertiesWithHistory', 'updated_at' => 'getUpdatedAt', - 'url' => 'getUrl' + 'url' => 'getUrl', + 'warnings' => 'getWarnings' ]; /** @@ -309,6 +315,7 @@ public function __construct(?array $data = null) $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } /** @@ -624,7 +631,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url Direct URL for this object in HubSpot + * @param string|null $url The URL associated with the object. * * @return self */ @@ -637,6 +644,33 @@ public function setUrl($url) return $this; } + + /** + * Gets warnings + * + * @return \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null + */ + public function getWarnings() + { + return $this->container['warnings']; + } + + /** + * Sets warnings + * + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectWarning[]|null $warnings warnings + * + * @return self + */ + public function setWarnings($warnings) + { + if (is_null($warnings)) { + throw new \InvalidArgumentException('non-nullable warnings cannot be null'); + } + $this->container['warnings'] = $warnings; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Crm/Objects/Model/StandardError.php b/codegen/Crm/Objects/Model/StandardError.php index e25639bf..14d20813 100644 --- a/codegen/Crm/Objects/Model/StandardError.php +++ b/codegen/Crm/Objects/Model/StandardError.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Model/ValueWithTimestamp.php index fe768205..41ff0559 100644 --- a/codegen/Crm/Objects/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Model/ValueWithTimestamp.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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. * @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Api/BasicApi.php b/codegen/Crm/Objects/Notes/Api/BasicApi.php index ebc0118b..8534806e 100644 --- a/codegen/Crm/Objects/Notes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Notes/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($note_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($note_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Notes/Api/BatchApi.php b/codegen/Crm/Objects/Notes/Api/BatchApi.php index f677200d..35aec598 100644 --- a/codegen/Crm/Objects/Notes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Notes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Notes/Api/SearchApi.php b/codegen/Crm/Objects/Notes/Api/SearchApi.php index 8ac9f231..08233a58 100644 --- a/codegen/Crm/Objects/Notes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Notes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Notes/Model/AssociatedId.php b/codegen/Crm/Objects/Notes/Model/AssociatedId.php index b35c5fca..1a562f4b 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Notes/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php index 5c97b750..2f12d2e8 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php index 65784d66..6f79bcb8 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php index 63f0985e..3f0d55bf 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php index e6e52e1a..8e65b105 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 854a2c6b..00000000 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Notes\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Notes\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\Paging|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\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObject.php index 3d0631a6..f639f2d0 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php index dedf8414..152ce1ff 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php index dbb4e053..d9ed329a 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php index 535ea720..e3e73c6f 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Notes * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php index 1c92b2cf..30471ea6 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php index ce23f29c..f9eee646 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/StandardError.php b/codegen/Crm/Objects/Notes/Model/StandardError.php index 75eaca98..62c61d07 100644 --- a/codegen/Crm/Objects/Notes/Model/StandardError.php +++ b/codegen/Crm/Objects/Notes/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php index 4f723b35..cae676df 100644 --- a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/ObjectSerializer.php b/codegen/Crm/Objects/ObjectSerializer.php index 62b23b21..23fb3597 100644 --- a/codegen/Crm/Objects/ObjectSerializer.php +++ b/codegen/Crm/Objects/ObjectSerializer.php @@ -11,7 +11,7 @@ */ /** - * CRM Objects + * Custom 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 e080c9e6..ec78a583 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php @@ -328,17 +328,13 @@ public function archiveRequest($postal_mail_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -584,7 +580,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -605,17 +601,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -961,17 +953,13 @@ public function getByIdRequest($postal_mail_id, $archived = false, $associations } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1309,17 +1297,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1603,7 +1587,7 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1624,17 +1608,13 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php index 5d2e4fc9..59c55c0d 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php @@ -303,7 +303,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -324,17 +324,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -594,7 +590,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -615,17 +611,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -900,7 +892,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -921,17 +913,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1191,7 +1179,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1212,17 +1200,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1482,7 +1466,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1503,17 +1487,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php index 435b0e12..5f47233e 100644 --- a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php @@ -347,7 +347,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -368,17 +368,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php index 687d8be2..667cb39c 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php index b1749e8f..bc04e3ab 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php index 9fc68417..28778684 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php @@ -333,7 +333,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 */ @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php index ae6c411c..17d3283d 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php index e3ba6e51..200aea93 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 6fb5d477..00000000 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\PostalMail\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\Paging|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\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObject.php index 76d4ecfc..18efdebc 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php index 42edcee9..7a417ddd 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php index d81c0442..0dca33b4 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php @@ -330,7 +330,7 @@ public function getId() /** * Sets id * - * @param string $id The unique ID of the object. + * @param string $id The ID to update. 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 index 4aca6d1e..f69cda61 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php index 96cb8abf..50ead9ee 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\PostalMail * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php index dcf62cc6..67aafdba 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php index 22259ffa..d107707c 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/StandardError.php b/codegen/Crm/Objects/PostalMail/Model/StandardError.php index 941484f2..20e49641 100644 --- a/codegen/Crm/Objects/PostalMail/Model/StandardError.php +++ b/codegen/Crm/Objects/PostalMail/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php index 17327379..ccf3be33 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Api/BasicApi.php b/codegen/Crm/Objects/Tasks/Api/BasicApi.php index 457ac6a4..98d9c6fa 100644 --- a/codegen/Crm/Objects/Tasks/Api/BasicApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($task_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($task_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Tasks/Api/BatchApi.php b/codegen/Crm/Objects/Tasks/Api/BatchApi.php index 90a3a95d..c11cc513 100644 --- a/codegen/Crm/Objects/Tasks/Api/BatchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Tasks/Api/SearchApi.php b/codegen/Crm/Objects/Tasks/Api/SearchApi.php index ee243c2b..11fcb463 100644 --- a/codegen/Crm/Objects/Tasks/Api/SearchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php index 67c105d5..b159dd5d 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php index 5ddf966e..aab2c4c9 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php index 1590f60a..b51b5148 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php index 89b4e0ee..e0c1d1c5 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php index 53cbdd98..2b8e9582 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 25e9107c..00000000 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Tasks\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Tasks\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\Paging|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\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObject.php index 869b8452..457cc42f 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php index 91f542d3..a248693b 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php index 3ba7772e..04ce39f8 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php index e16ab709..e20a94fd 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Tasks * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php index c38c725c..8289306c 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php index 2fb4a389..c85c2b53 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/StandardError.php b/codegen/Crm/Objects/Tasks/Model/StandardError.php index f5b3ad70..b6f97112 100644 --- a/codegen/Crm/Objects/Tasks/Model/StandardError.php +++ b/codegen/Crm/Objects/Tasks/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php index 426a8dcb..5db69506 100644 --- a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Api/BasicApi.php b/codegen/Crm/Objects/Taxes/Api/BasicApi.php index f3b118f8..c46a96d9 100644 --- a/codegen/Crm/Objects/Taxes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($tax_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($tax_id, $archived = false, $associations = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Taxes/Api/BatchApi.php b/codegen/Crm/Objects/Taxes/Api/BatchApi.php index 91f4a6d7..f4149613 100644 --- a/codegen/Crm/Objects/Taxes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Taxes/Api/SearchApi.php b/codegen/Crm/Objects/Taxes/Api/SearchApi.php index 6302030d..c141879b 100644 --- a/codegen/Crm/Objects/Taxes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php index 2d7f5179..4a4eccb3 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php index 8148830e..d92efd7b 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php index 9c37020a..d8c4fddb 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php index 64d8d022..02307ad8 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php index 27bfd90a..806eb04a 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 2aa71a09..00000000 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Taxes\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Objects\Taxes\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\Paging|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\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObject.php index c2a9dc2d..b4209fba 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php index c11d1443..980d84a2 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php index 6448aed7..85d210e6 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php index e73d0a6c..5863de09 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Objects\Taxes * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php index 54066d37..c86a1adf 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php index c58a4194..a032ebea 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/StandardError.php b/codegen/Crm/Objects/Taxes/Model/StandardError.php index 077227bf..24707670 100644 --- a/codegen/Crm/Objects/Taxes/Model/StandardError.php +++ b/codegen/Crm/Objects/Taxes/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php index 61d03dbd..5827fffb 100644 --- a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Owners/Api/BasicApi.php b/codegen/Crm/Owners/Api/BasicApi.php index 05c18237..e7a1c1b2 100644 --- a/codegen/Crm/Owners/Api/BasicApi.php +++ b/codegen/Crm/Owners/Api/BasicApi.php @@ -412,7 +412,7 @@ public function crmV3OwnersRequest($after = null, $archived = false, $email = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -728,7 +728,7 @@ public function getByIdRequest($owner_id, $archived = false, $id_property = 'id' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Owners/Api/OwnersApi.php b/codegen/Crm/Owners/Api/OwnersApi.php deleted file mode 100644 index 0acf8b41..00000000 --- a/codegen/Crm/Owners/Api/OwnersApi.php +++ /dev/null @@ -1,842 +0,0 @@ - [ - 'application/json', - ], - 'getPage' => [ - '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 getById - * - * Retrieve a specific owner by ID - * - * @param int $owner_id (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Owners\Model\PublicOwner|\HubSpot\Client\Crm\Owners\Model\Error - */ - public function getById($owner_id, $id_property = 'id', $archived = false, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($owner_id, $id_property, $archived, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Retrieve a specific owner by ID - * - * @param int $owner_id (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Owners\Model\PublicOwner|\HubSpot\Client\Crm\Owners\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = false, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($owner_id, $id_property, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\PublicOwner', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\PublicOwner', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Owners\Model\PublicOwner', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Owners\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve a specific owner by ID - * - * @param int $owner_id (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsync($owner_id, $id_property = 'id', $archived = false, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($owner_id, $id_property, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Retrieve a specific owner by ID - * - * @param int $owner_id (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsyncWithHttpInfo($owner_id, $id_property = 'id', $archived = false, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Owners\Model\PublicOwner'; - $request = $this->getByIdRequest($owner_id, $id_property, $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 'getById' - * - * @param int $owner_id (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByIdRequest($owner_id, $id_property = 'id', $archived = false, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'owner_id' is set - if ($owner_id === null || (is_array($owner_id) && count($owner_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner_id when calling getById' - ); - } - - - - - $resourcePath = '/crm/v3/owners/{ownerId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id_property, - 'idProperty', // param base name - 'string', // 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 ($owner_id !== null) { - $resourcePath = str_replace( - '{' . 'ownerId' . '}', - ObjectSerializer::toPathValue($owner_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 - * - * Retrieve a paginated list of owners available in the account. - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging|\HubSpot\Client\Crm\Owners\Model\Error - */ - public function getPage($email = null, $after = null, $limit = 100, $archived = false, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($email, $after, $limit, $archived, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Retrieve a paginated list of owners available in the account. - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging|\HubSpot\Client\Crm\Owners\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, $archived = false, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($email, $after, $limit, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Owners\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Retrieve a paginated list of owners available in the account. - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($email = null, $after = null, $limit = 100, $archived = false, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($email, $after, $limit, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Retrieve a paginated list of owners available in the account. - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($email = null, $after = null, $limit = 100, $archived = false, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging'; - $request = $this->getPageRequest($email, $after, $limit, $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 'getPage' - * - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($email = null, $after = null, $limit = 100, $archived = false, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - $resourcePath = '/crm/v3/owners/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $email, - 'email', // param base name - 'string', // 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 - ) ?? []); - - - - - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Pipelines/Api/BasicApi.php b/codegen/Crm/Pipelines/Api/BasicApi.php index 618f3b2f..7b27a3e9 100644 --- a/codegen/Crm/Pipelines/Api/BasicApi.php +++ b/codegen/Crm/Pipelines/Api/BasicApi.php @@ -410,7 +410,7 @@ public function archiveRequest($object_type, $pipeline_id, $validate_deal_stage_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -695,7 +695,7 @@ public function archive_0Request($object_type, $pipeline_id, $stage_id, $validat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -979,7 +979,7 @@ public function createRequest($object_type, $pipeline_input, string $contentType if (isset($pipeline_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_input; } @@ -1000,7 +1000,7 @@ public function createRequest($object_type, $pipeline_input, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1304,7 +1304,7 @@ public function create_0Request($object_type, $pipeline_id, $pipeline_stage_inpu if (isset($pipeline_stage_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_input; } @@ -1325,7 +1325,7 @@ public function create_0Request($object_type, $pipeline_id, $pipeline_stage_inpu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1611,7 +1611,7 @@ public function getAllRequest($object_type, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1917,7 +1917,7 @@ public function getAll_0Request($object_type, $pipeline_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2223,7 +2223,7 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2544,7 +2544,7 @@ public function getAudit_0Request($object_type, $pipeline_id, $stage_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2850,7 +2850,7 @@ public function getByIdRequest($object_type, $pipeline_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3176,7 +3176,7 @@ public function getById_0Request($object_type, $pipeline_id, $stage_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3510,7 +3510,7 @@ public function replaceRequest($object_type, $pipeline_id, $pipeline_replace_inp if (isset($pipeline_replace_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_replace_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_replace_input; } @@ -3531,7 +3531,7 @@ public function replaceRequest($object_type, $pipeline_id, $pipeline_replace_inp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3855,7 +3855,7 @@ public function replace_0Request($object_type, $pipeline_id, $stage_id, $pipelin if (isset($pipeline_stage_replace_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_replace_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_replace_input; } @@ -3876,7 +3876,7 @@ public function replace_0Request($object_type, $pipeline_id, $stage_id, $pipelin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4202,7 +4202,7 @@ public function updateRequest($object_type, $pipeline_id, $pipeline_patch_input, if (isset($pipeline_patch_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_patch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_patch_input; } @@ -4223,7 +4223,7 @@ public function updateRequest($object_type, $pipeline_id, $pipeline_patch_input, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4539,7 +4539,7 @@ public function update_0Request($object_type, $pipeline_id, $stage_id, $pipeline if (isset($pipeline_stage_patch_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_patch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_patch_input; } @@ -4560,7 +4560,7 @@ public function update_0Request($object_type, $pipeline_id, $stage_id, $pipeline } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php b/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php deleted file mode 100644 index 1470855b..00000000 --- a/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php +++ /dev/null @@ -1,526 +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, - 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 getAudit - * - * Retrieve a reverse chronological list of all changes made to a specific pipeline stage. - * - * @param string $object_type The object type of the stage audit being retrieved (ex. deals or tickets) (required) - * @param string $stage_id The unique identifier for the pipeline stage being audited. (required) - * @param string $pipeline_id pipeline_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function getAudit($object_type, $stage_id, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) - { - list($response) = $this->getAuditWithHttpInfo($object_type, $stage_id, $pipeline_id, $contentType); - return $response; - } - - /** - * Operation getAuditWithHttpInfo - * - * Retrieve a reverse chronological list of all changes made to a specific pipeline stage. - * - * @param string $object_type The object type of the stage audit being retrieved (ex. deals or tickets) (required) - * @param string $stage_id The unique identifier for the pipeline stage being audited. (required) - * @param string $pipeline_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAuditWithHttpInfo($object_type, $stage_id, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) - { - $request = $this->getAuditRequest($object_type, $stage_id, $pipeline_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAuditAsync - * - * Retrieve a reverse chronological list of all changes made to a specific pipeline stage. - * - * @param string $object_type The object type of the stage audit being retrieved (ex. deals or tickets) (required) - * @param string $stage_id The unique identifier for the pipeline stage being audited. (required) - * @param string $pipeline_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAuditAsync($object_type, $stage_id, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) - { - return $this->getAuditAsyncWithHttpInfo($object_type, $stage_id, $pipeline_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAuditAsyncWithHttpInfo - * - * Retrieve a reverse chronological list of all changes made to a specific pipeline stage. - * - * @param string $object_type The object type of the stage audit being retrieved (ex. deals or tickets) (required) - * @param string $stage_id The unique identifier for the pipeline stage being audited. (required) - * @param string $pipeline_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAuditAsyncWithHttpInfo($object_type, $stage_id, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging'; - $request = $this->getAuditRequest($object_type, $stage_id, $pipeline_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 'getAudit' - * - * @param string $object_type The object type of the stage audit being retrieved (ex. deals or tickets) (required) - * @param string $stage_id The unique identifier for the pipeline stage being audited. (required) - * @param string $pipeline_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getAuditRequest($object_type, $stage_id, $pipeline_id, string $contentType = self::contentTypes['getAudit'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getAudit' - ); - } - - // verify the required parameter 'stage_id' is set - if ($stage_id === null || (is_array($stage_id) && count($stage_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stage_id when calling getAudit' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling getAudit' - ); - } - if (!preg_match("/.+/", $pipeline_id)) { - throw new \InvalidArgumentException("invalid value for \"pipeline_id\" when calling PipelineStageAuditsApi.getAudit, must conform to the pattern /.+/."); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}/audit'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($stage_id !== null) { - $resourcePath = str_replace( - '{' . 'stageId' . '}', - ObjectSerializer::toPathValue($stage_id), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Pipelines/Api/PipelineStagesApi.php b/codegen/Crm/Pipelines/Api/PipelineStagesApi.php deleted file mode 100644 index 4676d4de..00000000 --- a/codegen/Crm/Pipelines/Api/PipelineStagesApi.php +++ /dev/null @@ -1,2129 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'replace' => [ - '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 pipeline stage - * - * @param string $object_type The object type of the stage being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline from which the stage will be deleted. (required) - * @param string $stage_id The unique identifier of the stage to be deleted from the pipeline. (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_type, $pipeline_id, $stage_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a pipeline stage - * - * @param string $object_type The object type of the stage being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline from which the stage will be deleted. (required) - * @param string $stage_id The unique identifier of the stage to be deleted from the pipeline. (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\Pipelines\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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($object_type, $pipeline_id, $stage_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\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a pipeline stage - * - * @param string $object_type The object type of the stage being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline from which the stage will be deleted. (required) - * @param string $stage_id The unique identifier of the stage to be deleted from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_type, $pipeline_id, $stage_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a pipeline stage - * - * @param string $object_type The object type of the stage being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline from which the stage will be deleted. (required) - * @param string $stage_id The unique identifier of the stage to be deleted from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_type, $pipeline_id, $stage_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 $object_type The object type of the stage being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline from which the stage will be deleted. (required) - * @param string $stage_id The unique identifier of the stage to be deleted from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archive' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling archive' - ); - } - - // verify the required parameter 'stage_id' is set - if ($stage_id === null || (is_array($stage_id) && count($stage_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stage_id when calling archive' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - // path params - if ($stage_id !== null) { - $resourcePath = str_replace( - '{' . 'stageId' . '}', - ObjectSerializer::toPathValue($stage_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 a pipeline stage - * - * @param string $object_type The object type of the stage being created (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage will be added. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input pipeline_stage_input (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function create($object_type, $pipeline_id, $pipeline_stage_input, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($object_type, $pipeline_id, $pipeline_stage_input, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a pipeline stage - * - * @param string $object_type The object type of the stage being created (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage will be added. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($object_type, $pipeline_id, $pipeline_stage_input, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($object_type, $pipeline_id, $pipeline_stage_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 201: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a pipeline stage - * - * @param string $object_type The object type of the stage being created (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage will be added. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (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, $pipeline_id, $pipeline_stage_input, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($object_type, $pipeline_id, $pipeline_stage_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a pipeline stage - * - * @param string $object_type The object type of the stage being created (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage will be added. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (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, $pipeline_id, $pipeline_stage_input, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; - $request = $this->createRequest($object_type, $pipeline_id, $pipeline_stage_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 'create' - * - * @param string $object_type The object type of the stage being created (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage will be added. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (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, $pipeline_id, $pipeline_stage_input, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling create' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling create' - ); - } - - // verify the required parameter 'pipeline_stage_input' is set - if ($pipeline_stage_input === null || (is_array($pipeline_stage_input) && count($pipeline_stage_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_stage_input when calling create' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_stage_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($pipeline_stage_input)); - } else { - $httpBody = $pipeline_stage_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 getAll - * - * Return all stages of a pipeline - * - * @param string $object_type The object type of the stages being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline whose stages are being retrieved. (required) - * @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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function getAll($object_type, $pipeline_id, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($object_type, $pipeline_id, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Return all stages of a pipeline - * - * @param string $object_type The object type of the stages being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline whose stages are being retrieved. (required) - * @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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($object_type, $pipeline_id, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($object_type, $pipeline_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Return all stages of a pipeline - * - * @param string $object_type The object type of the stages being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline whose stages are being retrieved. (required) - * @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($object_type, $pipeline_id, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($object_type, $pipeline_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Return all stages of a pipeline - * - * @param string $object_type The object type of the stages being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline whose stages are being retrieved. (required) - * @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($object_type, $pipeline_id, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging'; - $request = $this->getAllRequest($object_type, $pipeline_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 'getAll' - * - * @param string $object_type The object type of the stages being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline whose stages are being retrieved. (required) - * @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($object_type, $pipeline_id, string $contentType = self::contentTypes['getAll'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getAll' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling getAll' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_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 getById - * - * Return a pipeline stage by ID - * - * @param string $object_type The object type of the stage being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be retrieved. (required) - * @param string $stage_id The unique identifier of the stage to be retrieved from the pipeline. (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function getById($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($object_type, $pipeline_id, $stage_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Return a pipeline stage by ID - * - * @param string $object_type The object type of the stage being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be retrieved. (required) - * @param string $stage_id The unique identifier of the stage to be retrieved from the pipeline. (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($object_type, $pipeline_id, $stage_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Return a pipeline stage by ID - * - * @param string $object_type The object type of the stage being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be retrieved. (required) - * @param string $stage_id The unique identifier of the stage to be retrieved from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($object_type, $pipeline_id, $stage_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Return a pipeline stage by ID - * - * @param string $object_type The object type of the stage being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be retrieved. (required) - * @param string $stage_id The unique identifier of the stage to be retrieved from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; - $request = $this->getByIdRequest($object_type, $pipeline_id, $stage_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 string $object_type The object type of the stage being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be retrieved. (required) - * @param string $stage_id The unique identifier of the stage to be retrieved from the pipeline. (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($object_type, $pipeline_id, $stage_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getById' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling getById' - ); - } - - // verify the required parameter 'stage_id' is set - if ($stage_id === null || (is_array($stage_id) && count($stage_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stage_id when calling getById' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - // path params - if ($stage_id !== null) { - $resourcePath = str_replace( - '{' . 'stageId' . '}', - ObjectSerializer::toPathValue($stage_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 replace - * - * Replace a pipeline stage - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage belongs. (required) - * @param string $stage_id The unique identifier of the stage to be replaced in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input pipeline_stage_input (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function replace($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, string $contentType = self::contentTypes['replace'][0]) - { - list($response) = $this->replaceWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, $contentType); - return $response; - } - - /** - * Operation replaceWithHttpInfo - * - * Replace a pipeline stage - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage belongs. (required) - * @param string $stage_id The unique identifier of the stage to be replaced in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function replaceWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, string $contentType = self::contentTypes['replace'][0]) - { - $request = $this->replaceRequest($object_type, $pipeline_id, $stage_id, $pipeline_stage_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation replaceAsync - * - * Replace a pipeline stage - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage belongs. (required) - * @param string $stage_id The unique identifier of the stage to be replaced in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsync($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, string $contentType = self::contentTypes['replace'][0]) - { - return $this->replaceAsyncWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation replaceAsyncWithHttpInfo - * - * Replace a pipeline stage - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage belongs. (required) - * @param string $stage_id The unique identifier of the stage to be replaced in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsyncWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, string $contentType = self::contentTypes['replace'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; - $request = $this->replaceRequest($object_type, $pipeline_id, $stage_id, $pipeline_stage_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 'replace' - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to which the stage belongs. (required) - * @param string $stage_id The unique identifier of the stage to be replaced in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStageInput $pipeline_stage_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function replaceRequest($object_type, $pipeline_id, $stage_id, $pipeline_stage_input, string $contentType = self::contentTypes['replace'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling replace' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling replace' - ); - } - - // verify the required parameter 'stage_id' is set - if ($stage_id === null || (is_array($stage_id) && count($stage_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stage_id when calling replace' - ); - } - - // verify the required parameter 'pipeline_stage_input' is set - if ($pipeline_stage_input === null || (is_array($pipeline_stage_input) && count($pipeline_stage_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_stage_input when calling replace' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - // path params - if ($stage_id !== null) { - $resourcePath = str_replace( - '{' . 'stageId' . '}', - ObjectSerializer::toPathValue($stage_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_stage_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($pipeline_stage_input)); - } else { - $httpBody = $pipeline_stage_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation update - * - * Update specific properties of an existing pipeline stage. - * - * @param string $object_type The object type of the stage being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be updated. (required) - * @param string $stage_id The unique identifier of the stage to be updated in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStagePatchInput $pipeline_stage_patch_input pipeline_stage_patch_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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function update($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update specific properties of an existing pipeline stage. - * - * @param string $object_type The object type of the stage being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be updated. (required) - * @param string $stage_id The unique identifier of the stage to be updated in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStagePatchInput $pipeline_stage_patch_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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\PipelineStage|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update specific properties of an existing pipeline stage. - * - * @param string $object_type The object type of the stage being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be updated. (required) - * @param string $stage_id The unique identifier of the stage to be updated in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStagePatchInput $pipeline_stage_patch_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($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update specific properties of an existing pipeline stage. - * - * @param string $object_type The object type of the stage being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be updated. (required) - * @param string $stage_id The unique identifier of the stage to be updated in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStagePatchInput $pipeline_stage_patch_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($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; - $request = $this->updateRequest($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_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 string $object_type The object type of the stage being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline containing the stage to be updated. (required) - * @param string $stage_id The unique identifier of the stage to be updated in the pipeline. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineStagePatchInput $pipeline_stage_patch_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($object_type, $pipeline_id, $stage_id, $pipeline_stage_patch_input, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling update' - ); - } - - // verify the required parameter 'stage_id' is set - if ($stage_id === null || (is_array($stage_id) && count($stage_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stage_id when calling update' - ); - } - - // verify the required parameter 'pipeline_stage_patch_input' is set - if ($pipeline_stage_patch_input === null || (is_array($pipeline_stage_patch_input) && count($pipeline_stage_patch_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_stage_patch_input when calling update' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - // path params - if ($stage_id !== null) { - $resourcePath = str_replace( - '{' . 'stageId' . '}', - ObjectSerializer::toPathValue($stage_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_stage_patch_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($pipeline_stage_patch_input)); - } else { - $httpBody = $pipeline_stage_patch_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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Pipelines/Api/PipelinesApi.php b/codegen/Crm/Pipelines/Api/PipelinesApi.php deleted file mode 100644 index 48c57353..00000000 --- a/codegen/Crm/Pipelines/Api/PipelinesApi.php +++ /dev/null @@ -1,2099 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'replace' => [ - '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 pipeline - * - * @param string $object_type The object type of the pipeline being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be deleted. (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_type, $pipeline_id, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_type, $pipeline_id, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a pipeline - * - * @param string $object_type The object type of the pipeline being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be deleted. (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($object_type, $pipeline_id, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($object_type, $pipeline_id, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $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\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a pipeline - * - * @param string $object_type The object type of the pipeline being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be deleted. (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($object_type, $pipeline_id, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_type, $pipeline_id, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a pipeline - * - * @param string $object_type The object type of the pipeline being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be deleted. (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($object_type, $pipeline_id, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_type, $pipeline_id, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $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 $object_type The object type of the pipeline being deleted (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be deleted. (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($object_type, $pipeline_id, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archive' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling archive' - ); - } - - - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_references_before_delete, - 'validateReferencesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_deal_stage_usages_before_delete, - 'validateDealStageUsagesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_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 a pipeline - * - * @param string $object_type The object type of the pipeline being created (ex. deals or tickets) (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input pipeline_input (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function create($object_type, $pipeline_input, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($object_type, $pipeline_input, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a pipeline - * - * @param string $object_type The object type of the pipeline being created (ex. deals or tickets) (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($object_type, $pipeline_input, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($object_type, $pipeline_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 201: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a pipeline - * - * @param string $object_type The object type of the pipeline being created (ex. deals or tickets) (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (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, $pipeline_input, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($object_type, $pipeline_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a pipeline - * - * @param string $object_type The object type of the pipeline being created (ex. deals or tickets) (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (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, $pipeline_input, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; - $request = $this->createRequest($object_type, $pipeline_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 'create' - * - * @param string $object_type The object type of the pipeline being created (ex. deals or tickets) (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (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, $pipeline_input, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling create' - ); - } - - // verify the required parameter 'pipeline_input' is set - if ($pipeline_input === null || (is_array($pipeline_input) && count($pipeline_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_input when calling create' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_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($pipeline_input)); - } else { - $httpBody = $pipeline_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 getAll - * - * Retrieve all pipelines - * - * @param string $object_type The object type of the pipelines being retrieved (ex. deals or tickets) (required) - * @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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function getAll($object_type, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($object_type, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Retrieve all pipelines - * - * @param string $object_type The object type of the pipelines being retrieved (ex. deals or tickets) (required) - * @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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($object_type, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Retrieve all pipelines - * - * @param string $object_type The object type of the pipelines being retrieved (ex. deals or tickets) (required) - * @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($object_type, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Retrieve all pipelines - * - * @param string $object_type The object type of the pipelines being retrieved (ex. deals or tickets) (required) - * @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($object_type, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging'; - $request = $this->getAllRequest($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 'getAll' - * - * @param string $object_type The object type of the pipelines being retrieved (ex. deals or tickets) (required) - * @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($object_type, string $contentType = self::contentTypes['getAll'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getAll' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($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 - ); - } - - /** - * Operation getById - * - * Return a pipeline by ID - * - * @param string $object_type The object type of the pipeline being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be retrieved. (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function getById($object_type, $pipeline_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($object_type, $pipeline_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Return a pipeline by ID - * - * @param string $object_type The object type of the pipeline being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be retrieved. (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\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($object_type, $pipeline_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($object_type, $pipeline_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Return a pipeline by ID - * - * @param string $object_type The object type of the pipeline being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be retrieved. (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($object_type, $pipeline_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($object_type, $pipeline_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Return a pipeline by ID - * - * @param string $object_type The object type of the pipeline being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be retrieved. (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($object_type, $pipeline_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; - $request = $this->getByIdRequest($object_type, $pipeline_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 string $object_type The object type of the pipeline being retrieved (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be retrieved. (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($object_type, $pipeline_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getById' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling getById' - ); - } - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_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 replace - * - * Replace a pipeline - * - * @param string $object_type The object type of the pipeline being replaced (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be replaced. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input pipeline_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function replace($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['replace'][0]) - { - list($response) = $this->replaceWithHttpInfo($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType); - return $response; - } - - /** - * Operation replaceWithHttpInfo - * - * Replace a pipeline - * - * @param string $object_type The object type of the pipeline being replaced (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be replaced. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function replaceWithHttpInfo($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['replace'][0]) - { - $request = $this->replaceRequest($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation replaceAsync - * - * Replace a pipeline - * - * @param string $object_type The object type of the pipeline being replaced (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be replaced. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsync($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['replace'][0]) - { - return $this->replaceAsyncWithHttpInfo($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation replaceAsyncWithHttpInfo - * - * Replace a pipeline - * - * @param string $object_type The object type of the pipeline being replaced (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be replaced. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsyncWithHttpInfo($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['replace'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; - $request = $this->replaceRequest($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $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 'replace' - * - * @param string $object_type The object type of the pipeline being replaced (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be replaced. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function replaceRequest($object_type, $pipeline_id, $pipeline_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['replace'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling replace' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling replace' - ); - } - - // verify the required parameter 'pipeline_input' is set - if ($pipeline_input === null || (is_array($pipeline_input) && count($pipeline_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_input when calling replace' - ); - } - - - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_references_before_delete, - 'validateReferencesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_deal_stage_usages_before_delete, - 'validateDealStageUsagesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_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($pipeline_input)); - } else { - $httpBody = $pipeline_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation update - * - * Perform a partial update of the pipeline identified by pipelineId. - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be updated. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input pipeline_patch_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error - */ - public function update($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Perform a partial update of the pipeline identified by pipelineId. - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be updated. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Pipelines\Model\Pipeline|\HubSpot\Client\Crm\Pipelines\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Pipeline', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Pipelines\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Perform a partial update of the pipeline identified by pipelineId. - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be updated. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsync($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Perform a partial update of the pipeline identified by pipelineId. - * - * @param string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be updated. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateAsyncWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; - $request = $this->updateRequest($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete, $validate_deal_stage_usages_before_delete, $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 string $object_type The object type of the pipeline being updated (ex. deals or tickets) (required) - * @param string $pipeline_id The unique identifier of the pipeline to be updated. (required) - * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool|null $validate_references_before_delete Indicates whether to validate references before deleting the pipeline. (optional, default to false) - * @param bool|null $validate_deal_stage_usages_before_delete Indicates whether to validate deal stage usages before deleting the pipeline. (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function updateRequest($object_type, $pipeline_id, $pipeline_patch_input, $validate_references_before_delete = false, $validate_deal_stage_usages_before_delete = false, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' - ); - } - - // verify the required parameter 'pipeline_id' is set - if ($pipeline_id === null || (is_array($pipeline_id) && count($pipeline_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_id when calling update' - ); - } - - // verify the required parameter 'pipeline_patch_input' is set - if ($pipeline_patch_input === null || (is_array($pipeline_patch_input) && count($pipeline_patch_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pipeline_patch_input when calling update' - ); - } - - - - - $resourcePath = '/crm/v3/pipelines/{objectType}/{pipelineId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_references_before_delete, - 'validateReferencesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $validate_deal_stage_usages_before_delete, - 'validateDealStageUsagesBeforeDelete', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($pipeline_id !== null) { - $resourcePath = str_replace( - '{' . 'pipelineId' . '}', - ObjectSerializer::toPathValue($pipeline_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($pipeline_patch_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($pipeline_patch_input)); - } else { - $httpBody = $pipeline_patch_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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Products/Api/BasicApi.php b/codegen/Crm/Products/Api/BasicApi.php index e0f2f253..8ee1283b 100644 --- a/codegen/Crm/Products/Api/BasicApi.php +++ b/codegen/Crm/Products/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($product_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($product_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($product_id, $simple_public_object_input, $id_prop 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($product_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Products/Api/BatchApi.php b/codegen/Crm/Products/Api/BatchApi.php index 86e4de09..87654f2e 100644 --- a/codegen/Crm/Products/Api/BatchApi.php +++ b/codegen/Crm/Products/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Products/Api/SearchApi.php b/codegen/Crm/Products/Api/SearchApi.php index 6b024c7e..45aa63fa 100644 --- a/codegen/Crm/Products/Api/SearchApi.php +++ b/codegen/Crm/Products/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Products/Model/AssociatedId.php b/codegen/Crm/Products/Model/AssociatedId.php index 5c5f0588..05d45365 100644 --- a/codegen/Crm/Products/Model/AssociatedId.php +++ b/codegen/Crm/Products/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Products/Model/AssociationSpec.php b/codegen/Crm/Products/Model/AssociationSpec.php index a058a5b9..78843a0c 100644 --- a/codegen/Crm/Products/Model/AssociationSpec.php +++ b/codegen/Crm/Products/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php index 4fbc3211..d775fa1e 100644 --- a/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php index c6ca7783..99c8f5a4 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php index d5a66e88..60fda20c 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Products\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index 515ef872..00000000 --- a/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Products\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Products\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Products\Model\Paging|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\Crm\Products\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObject.php index 1adcce78..6a254386 100644 --- a/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Products/Model/SimplePublicObject.php b/codegen/Crm/Products/Model/SimplePublicObject.php index e881171e..e90e1072 100644 --- a/codegen/Crm/Products/Model/SimplePublicObject.php +++ b/codegen/Crm/Products/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php index b595319e..6d497182 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Products/Model/SimplePublicObjectInput.php b/codegen/Crm/Products/Model/SimplePublicObjectInput.php index 86d44f25..3c2e6a0b 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Products * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php index 316c1130..15302641 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php index 7fe1ee91..8e271519 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Products/Model/StandardError.php b/codegen/Crm/Products/Model/StandardError.php index f4ea7b95..3340e362 100644 --- a/codegen/Crm/Products/Model/StandardError.php +++ b/codegen/Crm/Products/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Products/Model/ValueWithTimestamp.php b/codegen/Crm/Products/Model/ValueWithTimestamp.php index 86af2bed..aa4ee09b 100644 --- a/codegen/Crm/Products/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Products/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Properties/Api/BasicApi.php b/codegen/Crm/Properties/Api/BasicApi.php index 70b85c87..cb0378d5 100644 --- a/codegen/Crm/Properties/Api/BasicApi.php +++ b/codegen/Crm/Properties/Api/BasicApi.php @@ -353,7 +353,7 @@ public function archiveRequest($object_type, $group_name, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function createRequest($object_type, $property_group_create, string $cont if (isset($property_group_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_group_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $property_group_create; } @@ -658,7 +658,7 @@ public function createRequest($object_type, $property_group_create, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -959,7 +959,7 @@ public function getAllRequest($object_type, $locale = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1280,7 +1280,7 @@ public function getByNameRequest($object_type, $group_name, $locale = null, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1584,7 +1584,7 @@ public function updateRequest($object_type, $group_name, $property_group_update, if (isset($property_group_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_group_update), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $property_group_update; } @@ -1605,7 +1605,7 @@ public function updateRequest($object_type, $group_name, $property_group_update, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/BatchApi.php b/codegen/Crm/Properties/Api/BatchApi.php index 7795a483..2f3a0fcb 100644 --- a/codegen/Crm/Properties/Api/BatchApi.php +++ b/codegen/Crm/Properties/Api/BatchApi.php @@ -325,7 +325,7 @@ public function archiveRequest($object_type, $batch_input_property_name, string if (isset($batch_input_property_name)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_property_name), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_property_name; } @@ -346,7 +346,7 @@ public function archiveRequest($object_type, $batch_input_property_name, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -644,7 +644,7 @@ public function createRequest($object_type, $batch_input_property_create, string if (isset($batch_input_property_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_property_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_property_create; } @@ -665,7 +665,7 @@ public function createRequest($object_type, $batch_input_property_create, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -978,7 +978,7 @@ public function readRequest($object_type, $batch_read_input_property_name, $loca if (isset($batch_read_input_property_name)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_property_name), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_property_name; } @@ -999,7 +999,7 @@ public function readRequest($object_type, $batch_read_input_property_name, $loca } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/CoreApi.php b/codegen/Crm/Properties/Api/CoreApi.php index 7c3c0942..3a482f78 100644 --- a/codegen/Crm/Properties/Api/CoreApi.php +++ b/codegen/Crm/Properties/Api/CoreApi.php @@ -353,7 +353,7 @@ public function archiveRequest($object_type, $property_name, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function createRequest($object_type, $property_create, string $contentTyp if (isset($property_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $property_create; } @@ -658,7 +658,7 @@ public function createRequest($object_type, $property_create, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1004,7 +1004,7 @@ public function getAllRequest($object_type, $archived = false, $properties = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1370,7 +1370,7 @@ public function getByNameRequest($object_type, $property_name, $archived = false } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1674,7 +1674,7 @@ public function updateRequest($object_type, $property_name, $property_update, st if (isset($property_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_update), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $property_update; } @@ -1695,7 +1695,7 @@ public function updateRequest($object_type, $property_name, $property_update, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/GroupsApi.php b/codegen/Crm/Properties/Api/GroupsApi.php deleted file mode 100644 index 8e4b2552..00000000 --- a/codegen/Crm/Properties/Api/GroupsApi.php +++ /dev/null @@ -1,1711 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - 'application/json', - ], - 'getByName' => [ - '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 - * - * Archive a property group - * - * @param string $object_type (required) - * @param string $group_name (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\Properties\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_type, $group_name, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_type, $group_name, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Archive a property group - * - * @param string $object_type (required) - * @param string $group_name (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\Properties\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($object_type, $group_name, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($object_type, $group_name, $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\Properties\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Archive a property group - * - * @param string $object_type (required) - * @param string $group_name (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($object_type, $group_name, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_type, $group_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Archive a property group - * - * @param string $object_type (required) - * @param string $group_name (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($object_type, $group_name, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_type, $group_name, $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 $object_type (required) - * @param string $group_name (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($object_type, $group_name, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archive' - ); - } - - // verify the required parameter 'group_name' is set - if ($group_name === null || (is_array($group_name) && count($group_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group_name when calling archive' - ); - } - - - $resourcePath = '/crm/v3/properties/{objectType}/groups/{groupName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($group_name !== null) { - $resourcePath = str_replace( - '{' . 'groupName' . '}', - ObjectSerializer::toPathValue($group_name), - $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 a property group - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create property_group_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\Properties\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error - */ - public function create($object_type, $property_group_create, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($object_type, $property_group_create, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a property group - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_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\Properties\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($object_type, $property_group_create, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($object_type, $property_group_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a property group - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_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, $property_group_create, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($object_type, $property_group_create, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a property group - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_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, $property_group_create, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - $request = $this->createRequest($object_type, $property_group_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 string $object_type (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_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, $property_group_create, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling create' - ); - } - - // verify the required parameter 'property_group_create' is set - if ($property_group_create === null || (is_array($property_group_create) && count($property_group_create) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $property_group_create when calling create' - ); - } - - - $resourcePath = '/crm/v3/properties/{objectType}/groups'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($property_group_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($property_group_create)); - } else { - $httpBody = $property_group_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 getAll - * - * Read all property groups - * - * @param string $object_type (required) - * @param string|null $locale (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging|\HubSpot\Client\Crm\Properties\Model\Error - */ - public function getAll($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($object_type, $locale, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Read all property groups - * - * @param string $object_type (required) - * @param string|null $locale (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($object_type, $locale, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Read all property groups - * - * @param string $object_type (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsync($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($object_type, $locale, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Read all property groups - * - * @param string $object_type (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsyncWithHttpInfo($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging'; - $request = $this->getAllRequest($object_type, $locale, $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 $object_type (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getAllRequest($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getAll' - ); - } - - - - $resourcePath = '/crm/v3/properties/{objectType}/groups'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $locale, - 'locale', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($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 - ); - } - - /** - * Operation getByName - * - * Read a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param string|null $locale (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error - */ - public function getByName($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) - { - list($response) = $this->getByNameWithHttpInfo($object_type, $group_name, $locale, $contentType); - return $response; - } - - /** - * Operation getByNameWithHttpInfo - * - * Read a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param string|null $locale (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByNameWithHttpInfo($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) - { - $request = $this->getByNameRequest($object_type, $group_name, $locale, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByNameAsync - * - * Read a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByNameAsync($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) - { - return $this->getByNameAsyncWithHttpInfo($object_type, $group_name, $locale, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByNameAsyncWithHttpInfo - * - * Read a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByNameAsyncWithHttpInfo($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) - { - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - $request = $this->getByNameRequest($object_type, $group_name, $locale, $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 'getByName' - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param string|null $locale (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByNameRequest($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getByName' - ); - } - - // verify the required parameter 'group_name' is set - if ($group_name === null || (is_array($group_name) && count($group_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group_name when calling getByName' - ); - } - - - - $resourcePath = '/crm/v3/properties/{objectType}/groups/{groupName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $locale, - 'locale', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($group_name !== null) { - $resourcePath = str_replace( - '{' . 'groupName' . '}', - ObjectSerializer::toPathValue($group_name), - $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 update - * - * Update a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update property_group_update (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\Properties\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error - */ - public function update($object_type, $group_name, $property_group_update, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_type, $group_name, $property_group_update, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (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\Properties\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_type, $group_name, $property_group_update, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_type, $group_name, $property_group_update, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (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($object_type, $group_name, $property_group_update, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_type, $group_name, $property_group_update, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a property group - * - * @param string $object_type (required) - * @param string $group_name (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (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($object_type, $group_name, $property_group_update, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - $request = $this->updateRequest($object_type, $group_name, $property_group_update, $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 string $object_type (required) - * @param string $group_name (required) - * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (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($object_type, $group_name, $property_group_update, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' - ); - } - - // verify the required parameter 'group_name' is set - if ($group_name === null || (is_array($group_name) && count($group_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $group_name when calling update' - ); - } - - // verify the required parameter 'property_group_update' is set - if ($property_group_update === null || (is_array($property_group_update) && count($property_group_update) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $property_group_update when calling update' - ); - } - - - $resourcePath = '/crm/v3/properties/{objectType}/groups/{groupName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($group_name !== null) { - $resourcePath = str_replace( - '{' . 'groupName' . '}', - ObjectSerializer::toPathValue($group_name), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($property_group_update)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($property_group_update)); - } else { - $httpBody = $property_group_update; - } - } 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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Quotes/Api/BasicApi.php b/codegen/Crm/Quotes/Api/BasicApi.php index 7bcf3ba4..75d7d993 100644 --- a/codegen/Crm/Quotes/Api/BasicApi.php +++ b/codegen/Crm/Quotes/Api/BasicApi.php @@ -336,17 +336,13 @@ public function archiveRequest($quote_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -600,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,17 +617,13 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -985,17 +977,13 @@ public function getByIdRequest($quote_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1341,17 +1329,13 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1643,7 +1627,7 @@ public function updateRequest($quote_id, $simple_public_object_input, $id_proper 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,17 +1648,13 @@ public function updateRequest($quote_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Quotes/Api/BatchApi.php b/codegen/Crm/Quotes/Api/BatchApi.php index f361ba2e..c766ae61 100644 --- a/codegen/Crm/Quotes/Api/BatchApi.php +++ b/codegen/Crm/Quotes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,17 +332,13 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -610,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,17 +627,13 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -924,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,17 +937,13 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1223,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,17 +1232,13 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -1522,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,17 +1527,13 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Quotes/Api/SearchApi.php b/codegen/Crm/Quotes/Api/SearchApi.php index f23fcab8..02a626b0 100644 --- a/codegen/Crm/Quotes/Api/SearchApi.php +++ b/codegen/Crm/Quotes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,17 +376,13 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Crm/Quotes/Model/AssociatedId.php b/codegen/Crm/Quotes/Model/AssociatedId.php index e21b02a6..eeb8c212 100644 --- a/codegen/Crm/Quotes/Model/AssociatedId.php +++ b/codegen/Crm/Quotes/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/AssociationSpec.php b/codegen/Crm/Quotes/Model/AssociationSpec.php index a066aa7d..16fa96eb 100644 --- a/codegen/Crm/Quotes/Model/AssociationSpec.php +++ b/codegen/Crm/Quotes/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php index ccb96c54..11466aca 100644 --- a/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php index 840fd0b0..d17eaba3 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php index 93dba179..2b891120 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index a69516d6..00000000 --- a/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Quotes\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Quotes\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Quotes\Model\Paging|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\Crm\Quotes\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObject.php index fd7b3bd5..ae5b19f2 100644 --- a/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObject.php b/codegen/Crm/Quotes/Model/SimplePublicObject.php index fd1af566..392983d2 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObject.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php index 9d7dd980..11bda9fa 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php b/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php index bfcffd18..9e93ac0e 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Quotes * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php index 80a10397..de91c76c 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php index a839d905..eded8d5f 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/StandardError.php b/codegen/Crm/Quotes/Model/StandardError.php index 718d44ed..cfa83cc9 100644 --- a/codegen/Crm/Quotes/Model/StandardError.php +++ b/codegen/Crm/Quotes/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Quotes/Model/ValueWithTimestamp.php b/codegen/Crm/Quotes/Model/ValueWithTimestamp.php index 49955a3e..279cbeaa 100644 --- a/codegen/Crm/Quotes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Quotes/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Schemas/Api/AdvancedApi.php b/codegen/Crm/Schemas/Api/AdvancedApi.php index 6bbc70b9..44da5362 100644 --- a/codegen/Crm/Schemas/Api/AdvancedApi.php +++ b/codegen/Crm/Schemas/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function createAssociationRequest($object_type, $association_definition_e if (isset($association_definition_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($association_definition_egg), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $association_definition_egg; } @@ -396,7 +396,7 @@ public function createAssociationRequest($object_type, $association_definition_e } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/BasicApi.php b/codegen/Crm/Schemas/Api/BasicApi.php index 23a806e2..5f4361f1 100644 --- a/codegen/Crm/Schemas/Api/BasicApi.php +++ b/codegen/Crm/Schemas/Api/BasicApi.php @@ -351,7 +351,7 @@ public function archiveRequest($object_type, $archived = false, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -601,7 +601,7 @@ public function archiveAssociationRequest($association_identifier, $object_type, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -865,7 +865,7 @@ public function createRequest($object_schema_egg, string $contentType = self::co if (isset($object_schema_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_schema_egg), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $object_schema_egg; } @@ -886,7 +886,7 @@ public function createRequest($object_schema_egg, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1212,7 +1212,7 @@ public function getAllRequest($archived = false, $include_association_definition } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1543,7 +1543,7 @@ public function getByIdRequest($object_type, $include_association_definitions = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1827,7 +1827,7 @@ public function updateRequest($object_type, $object_type_definition_patch, strin if (isset($object_type_definition_patch)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_type_definition_patch), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $object_type_definition_patch; } @@ -1848,7 +1848,7 @@ public function updateRequest($object_type, $object_type_definition_patch, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/BatchApi.php b/codegen/Crm/Schemas/Api/BatchApi.php index 14d29071..e0371c50 100644 --- a/codegen/Crm/Schemas/Api/BatchApi.php +++ b/codegen/Crm/Schemas/Api/BatchApi.php @@ -355,7 +355,7 @@ public function crmObjectSchemasV3SchemasBatchReadRequest($object_schema_batch_r if (isset($object_schema_batch_read_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_schema_batch_read_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $object_schema_batch_read_request; } @@ -376,7 +376,7 @@ public function crmObjectSchemasV3SchemasBatchReadRequest($object_schema_batch_r } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/CoreApi.php b/codegen/Crm/Schemas/Api/CoreApi.php deleted file mode 100644 index c5e9405e..00000000 --- a/codegen/Crm/Schemas/Api/CoreApi.php +++ /dev/null @@ -1,2116 +0,0 @@ - [ - 'application/json', - ], - 'archiveAssociation' => [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'createAssociation' => [ - 'application/json', - ], - 'getAll' => [ - '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 - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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['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 - * @throws \InvalidArgumentException - * @return void - */ - public function archive($object_type, $archived = false, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($object_type, $archived, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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['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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($object_type, $archived = false, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($object_type, $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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($object_type, $archived = false, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($object_type, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($object_type, $archived = false, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($object_type, $archived, $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 $object_type Fully qualified name or object type ID of your schema. (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['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($object_type, $archived = false, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archive' - ); - } - - - - $resourcePath = '/crm-object-schemas/v3/schemas/{objectType}'; - $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 - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $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 archiveAssociation - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param string $association_identifier Unique ID of the association to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssociation'] 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 - * @throws \InvalidArgumentException - * @return void - */ - public function archiveAssociation($object_type, $association_identifier, string $contentType = self::contentTypes['archiveAssociation'][0]) - { - $this->archiveAssociationWithHttpInfo($object_type, $association_identifier, $contentType); - } - - /** - * Operation archiveAssociationWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param string $association_identifier Unique ID of the association to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssociation'] 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 - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveAssociationWithHttpInfo($object_type, $association_identifier, string $contentType = self::contentTypes['archiveAssociation'][0]) - { - $request = $this->archiveAssociationRequest($object_type, $association_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(); - - - return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAssociationAsync - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param string $association_identifier Unique ID of the association to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAssociationAsync($object_type, $association_identifier, string $contentType = self::contentTypes['archiveAssociation'][0]) - { - return $this->archiveAssociationAsyncWithHttpInfo($object_type, $association_identifier, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAssociationAsyncWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param string $association_identifier Unique ID of the association to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAssociationAsyncWithHttpInfo($object_type, $association_identifier, string $contentType = self::contentTypes['archiveAssociation'][0]) - { - $returnType = ''; - $request = $this->archiveAssociationRequest($object_type, $association_identifier, $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 'archiveAssociation' - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param string $association_identifier Unique ID of the association to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveAssociationRequest($object_type, $association_identifier, string $contentType = self::contentTypes['archiveAssociation'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archiveAssociation' - ); - } - - // verify the required parameter 'association_identifier' is set - if ($association_identifier === null || (is_array($association_identifier) && count($association_identifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_identifier when calling archiveAssociation' - ); - } - - - $resourcePath = '/crm-object-schemas/v3/schemas/{objectType}/associations/{associationIdentifier}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if ($association_identifier !== null) { - $resourcePath = str_replace( - '{' . 'associationIdentifier' . '}', - ObjectSerializer::toPathValue($association_identifier), - $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 - * - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectSchemaEgg $object_schema_egg Object schema definition, including properties and associations. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Schemas\Model\ObjectSchema|\HubSpot\Client\Crm\Schemas\Model\Error - */ - public function create($object_schema_egg, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($object_schema_egg, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectSchemaEgg $object_schema_egg Object schema definition, including properties and associations. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Schemas\Model\ObjectSchema|\HubSpot\Client\Crm\Schemas\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($object_schema_egg, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($object_schema_egg, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectSchemaEgg $object_schema_egg Object schema definition, including properties and associations. (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_schema_egg, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($object_schema_egg, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectSchemaEgg $object_schema_egg Object schema definition, including properties and associations. (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_schema_egg, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema'; - $request = $this->createRequest($object_schema_egg, $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\Schemas\Model\ObjectSchemaEgg $object_schema_egg Object schema definition, including properties and associations. (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_schema_egg, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'object_schema_egg' is set - if ($object_schema_egg === null || (is_array($object_schema_egg) && count($object_schema_egg) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_schema_egg when calling create' - ); - } - - - $resourcePath = '/crm-object-schemas/v3/schemas'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($object_schema_egg)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($object_schema_egg)); - } else { - $httpBody = $object_schema_egg; - } - } 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 createAssociation - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\AssociationDefinitionEgg $association_definition_egg Attributes that define the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAssociation'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Schemas\Model\AssociationDefinition|\HubSpot\Client\Crm\Schemas\Model\Error - */ - public function createAssociation($object_type, $association_definition_egg, string $contentType = self::contentTypes['createAssociation'][0]) - { - list($response) = $this->createAssociationWithHttpInfo($object_type, $association_definition_egg, $contentType); - return $response; - } - - /** - * Operation createAssociationWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\AssociationDefinitionEgg $association_definition_egg Attributes that define the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAssociation'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Schemas\Model\AssociationDefinition|\HubSpot\Client\Crm\Schemas\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createAssociationWithHttpInfo($object_type, $association_definition_egg, string $contentType = self::contentTypes['createAssociation'][0]) - { - $request = $this->createAssociationRequest($object_type, $association_definition_egg, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\AssociationDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\AssociationDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\AssociationDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAssociationAsync - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\AssociationDefinitionEgg $association_definition_egg Attributes that define the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAssociationAsync($object_type, $association_definition_egg, string $contentType = self::contentTypes['createAssociation'][0]) - { - return $this->createAssociationAsyncWithHttpInfo($object_type, $association_definition_egg, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAssociationAsyncWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\AssociationDefinitionEgg $association_definition_egg Attributes that define the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAssociationAsyncWithHttpInfo($object_type, $association_definition_egg, string $contentType = self::contentTypes['createAssociation'][0]) - { - $returnType = '\HubSpot\Client\Crm\Schemas\Model\AssociationDefinition'; - $request = $this->createAssociationRequest($object_type, $association_definition_egg, $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 'createAssociation' - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\AssociationDefinitionEgg $association_definition_egg Attributes that define the association. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAssociation'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createAssociationRequest($object_type, $association_definition_egg, string $contentType = self::contentTypes['createAssociation'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling createAssociation' - ); - } - - // verify the required parameter 'association_definition_egg' is set - if ($association_definition_egg === null || (is_array($association_definition_egg) && count($association_definition_egg) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_definition_egg when calling createAssociation' - ); - } - - - $resourcePath = '/crm-object-schemas/v3/schemas/{objectType}/associations'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($association_definition_egg)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($association_definition_egg)); - } else { - $httpBody = $association_definition_egg; - } - } 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 - * - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging|\HubSpot\Client\Crm\Schemas\Model\Error - */ - public function getAll($archived = false, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($archived, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging|\HubSpot\Client\Crm\Schemas\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($archived = false, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsync($archived = false, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getAllAsyncWithHttpInfo($archived = false, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging'; - $request = $this->getAllRequest($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 'getAll' - * - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getAllRequest($archived = false, string $contentType = self::contentTypes['getAll'][0]) - { - - - - $resourcePath = '/crm-object-schemas/v3/schemas'; - $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 (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 getById - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Schemas\Model\ObjectSchema|\HubSpot\Client\Crm\Schemas\Model\Error - */ - public function getById($object_type, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($object_type, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Schemas\Model\ObjectSchema|\HubSpot\Client\Crm\Schemas\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($object_type, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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($object_type, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($object_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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($object_type, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema'; - $request = $this->getByIdRequest($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 'getById' - * - * @param string $object_type Fully qualified name or object type ID of your schema. (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($object_type, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getById' - ); - } - - - $resourcePath = '/crm-object-schemas/v3/schemas/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($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 - ); - } - - /** - * Operation update - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinitionPatch $object_type_definition_patch Attributes to update in your schema. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition|\HubSpot\Client\Crm\Schemas\Model\Error - */ - public function update($object_type, $object_type_definition_patch, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($object_type, $object_type_definition_patch, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinitionPatch $object_type_definition_patch Attributes to update in your schema. (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\Schemas\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition|\HubSpot\Client\Crm\Schemas\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_type, $object_type_definition_patch, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($object_type, $object_type_definition_patch, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Schemas\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinitionPatch $object_type_definition_patch Attributes to update in your schema. (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($object_type, $object_type_definition_patch, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($object_type, $object_type_definition_patch, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinitionPatch $object_type_definition_patch Attributes to update in your schema. (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($object_type, $object_type_definition_patch, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition'; - $request = $this->updateRequest($object_type, $object_type_definition_patch, $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 string $object_type Fully qualified name or object type ID of your schema. (required) - * @param \HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinitionPatch $object_type_definition_patch Attributes to update in your schema. (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($object_type, $object_type_definition_patch, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' - ); - } - - // verify the required parameter 'object_type_definition_patch' is set - if ($object_type_definition_patch === null || (is_array($object_type_definition_patch) && count($object_type_definition_patch) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type_definition_patch when calling update' - ); - } - - - $resourcePath = '/crm-object-schemas/v3/schemas/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_type !== null) { - $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($object_type_definition_patch)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($object_type_definition_patch)); - } else { - $httpBody = $object_type_definition_patch; - } - } 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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Tickets/Api/AdvancedApi.php b/codegen/Crm/Tickets/Api/AdvancedApi.php index f9393bde..a759b1ac 100644 --- a/codegen/Crm/Tickets/Api/AdvancedApi.php +++ b/codegen/Crm/Tickets/Api/AdvancedApi.php @@ -355,7 +355,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -376,7 +376,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/BasicApi.php b/codegen/Crm/Tickets/Api/BasicApi.php index 1ef208a7..c0a4b551 100644 --- a/codegen/Crm/Tickets/Api/BasicApi.php +++ b/codegen/Crm/Tickets/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($ticket_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -600,7 +600,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,7 +621,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -985,7 +985,7 @@ public function getByIdRequest($ticket_id, $archived = false, $associations = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1341,7 +1341,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1643,7 +1643,7 @@ public function updateRequest($ticket_id, $simple_public_object_input, $id_prope 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 = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,7 +1664,7 @@ public function updateRequest($ticket_id, $simple_public_object_input, $id_prope } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/BatchApi.php b/codegen/Crm/Tickets/Api/BatchApi.php index d5267e5c..13dfcf76 100644 --- a/codegen/Crm/Tickets/Api/BatchApi.php +++ b/codegen/Crm/Tickets/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -610,7 +610,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,7 +631,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -924,7 +924,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,7 +945,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1223,7 +1223,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,7 +1244,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1522,7 +1522,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,7 +1543,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/SearchApi.php b/codegen/Crm/Tickets/Api/SearchApi.php index 43271570..ae4b4653 100644 --- a/codegen/Crm/Tickets/Api/SearchApi.php +++ b/codegen/Crm/Tickets/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Model/AssociatedId.php b/codegen/Crm/Tickets/Model/AssociatedId.php index a6bc0496..04877082 100644 --- a/codegen/Crm/Tickets/Model/AssociatedId.php +++ b/codegen/Crm/Tickets/Model/AssociatedId.php @@ -316,7 +316,7 @@ public function getId() /** * Sets id * - * @param string $id The ID for the association type. + * @param string $id The unique identifier for the associated object. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/AssociationSpec.php b/codegen/Crm/Tickets/Model/AssociationSpec.php index 426f729b..0b923481 100644 --- a/codegen/Crm/Tickets/Model/AssociationSpec.php +++ b/codegen/Crm/Tickets/Model/AssociationSpec.php @@ -344,7 +344,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string $association_category The category of the association, such as \"HUBSPOT_DEFINED\". + * @param string $association_category The category of the association, indicating its origin or purpose. Valid values include \"HUBSPOT_DEFINED\", \"USER_DEFINED\", \"INTEGRATOR_DEFINED\", and \"WORK\". * * @return self */ @@ -381,7 +381,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int $association_type_id The ID representing the specific type of association. + * @param int $association_type_id An integer representing the unique identifier for the type of association. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php index 7519f236..b4431a7c 100644 --- a/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php @@ -360,7 +360,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectId[] $inputs inputs + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectId[] $inputs An array of SimplePublicObjectId objects, each containing the ID of an object to be read. * * @return self */ @@ -387,7 +387,7 @@ public function getProperties() /** * Sets properties * - * @param string[] $properties Key-value pairs for setting properties for the new object. + * @param string[] $properties An array of the property names to be returned in the response. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ @@ -414,7 +414,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param string[] $properties_with_history Key-value pairs for setting properties for the new object and their histories. + * @param string[] $properties_with_history An array of the property names to be returned along with their history of previous values. If a specified property is not present on the requested object(s), it will be ignored. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php index 79cfe2a2..562f505f 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject[] $results An array of SimplePublicObject items representing the results of the batch operation. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php index 0e90b733..e230b590 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php @@ -405,7 +405,7 @@ public function getLinks() /** * Sets links * - * @param array|null $links An object containing relevant links related to the batch request. + * @param array|null $links A map of link names to associated URIs, providing additional information or actions related to the batch operation. * * @return self */ @@ -459,7 +459,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicUpsertObject[] $results results + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicUpsertObject[] $results An array of SimplePublicUpsertObject items representing the results of the batch upsert operation. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociations.php deleted file mode 100644 index a424f1c4..00000000 --- a/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Tickets\Model\Paging', - 'results' => '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations[]' - ]; - - /** - * 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\Crm\Tickets\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Crm\Tickets\Model\Paging|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\Crm\Tickets\Model\SimplePublicObjectWithAssociations[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations[] $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|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObject.php index 2c1bd678..68625d0a 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -350,7 +350,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject[] $results results + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject[] $results An array containing the simple public objects returned in the current page of the response. This property is required. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObject.php b/codegen/Crm/Tickets/Model/SimplePublicObject.php index 86c8c329..90475881 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObject.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObject.php @@ -486,7 +486,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id An identifier used for tracing the write request for the object. + * @param string|null $object_write_trace_id An identifier used to trace the write request for the object. Set a unique ID for each write operation; it is returned with any errors so you can identify which request encountered which error. * * @return self */ @@ -540,7 +540,7 @@ public function getPropertiesWithHistory() /** * Sets properties_with_history * - * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history. + * @param array|null $properties_with_history Key-value pairs representing the properties of the object along with their history, each with a timestamp and source information. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php index 8297fb1a..53bab271 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php @@ -320,7 +320,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null $associations An array of associations that define the relationships between the objects being created and other existing objects. This property is required. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php index 8c2d7cdf..c1fa346f 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php @@ -35,7 +35,7 @@ * SimplePublicObjectInput Class Doc Comment * * @category Class - * @description Represents the input required to create or update a CRM object, containing an object with property names and their corresponding values. + * @description Represents the input required to update a CRM object, containing an object with property names and their corresponding values. * @package HubSpot\Client\Crm\Tickets * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php index 6f211a2d..0f258f92 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php @@ -313,7 +313,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null $associations associations + * @param \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null $associations An array that specifies the relationships between the new public object and existing objects. This is required to establish how the new object is connected within the system. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php index f9dd3bd1..2e5ac1b4 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php @@ -439,7 +439,7 @@ public function getAssociations() /** * Sets associations * - * @param array|null $associations A list defining relationships with other objects. + * @param array|null $associations A map of associated object types to their associated IDs. * * @return self */ @@ -628,7 +628,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL on the API that provide direct navigation to the corresponding UI pages for the connectors. + * @param string|null $url The URL link to access this object. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/StandardError.php b/codegen/Crm/Tickets/Model/StandardError.php index 3bf56922..858b723b 100644 --- a/codegen/Crm/Tickets/Model/StandardError.php +++ b/codegen/Crm/Tickets/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Crm/Tickets/Model/ValueWithTimestamp.php b/codegen/Crm/Tickets/Model/ValueWithTimestamp.php index e1b134b8..c2e742b1 100644 --- a/codegen/Crm/Tickets/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Tickets/Model/ValueWithTimestamp.php @@ -347,7 +347,7 @@ public function getSourceId() /** * Sets source_id * - * @param string|null $source_id The unique ID of the property. + * @param string|null $source_id A string identifier for the specific source of the value. * * @return self */ @@ -401,7 +401,7 @@ public function getSourceType() /** * Sets source_type * - * @param string $source_type The property type. + * @param string $source_type A string indicating the type of source from which the value originated. * * @return self */ diff --git a/codegen/Crm/Timeline/Api/AdvancedApi.php b/codegen/Crm/Timeline/Api/AdvancedApi.php index 6cc8e73f..5a655ab3 100644 --- a/codegen/Crm/Timeline/Api/AdvancedApi.php +++ b/codegen/Crm/Timeline/Api/AdvancedApi.php @@ -363,7 +363,7 @@ public function createRequest($timeline_event, string $contentType = self::conte if (isset($timeline_event)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event; } @@ -384,7 +384,7 @@ public function createRequest($timeline_event, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -693,7 +693,7 @@ public function create_0Request($app_id, $event_template_id, $timeline_event_tem if (isset($timeline_event_template_token)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_token), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_token; } @@ -714,16 +714,17 @@ public function create_0Request($app_id, $event_template_id, $timeline_event_tem } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Timeline/Api/BasicApi.php b/codegen/Crm/Timeline/Api/BasicApi.php index 2f16e2a0..5370a099 100644 --- a/codegen/Crm/Timeline/Api/BasicApi.php +++ b/codegen/Crm/Timeline/Api/BasicApi.php @@ -367,16 +367,17 @@ public function archiveRequest($app_id, $event_template_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -642,16 +643,17 @@ public function archive_0Request($app_id, $event_template_id, $token_name, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -931,7 +933,7 @@ public function createRequest($app_id, $timeline_event_template_create_request, if (isset($timeline_event_template_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_create_request; } @@ -952,16 +954,17 @@ public function createRequest($app_id, $timeline_event_template_create_request, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1243,16 +1246,17 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1554,7 +1558,7 @@ public function getByIdRequest($event_id, $event_template_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1865,16 +1869,17 @@ public function getById_0Request($app_id, $event_template_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2174,7 +2179,7 @@ public function updateRequest($app_id, $event_template_id, $timeline_event_templ if (isset($timeline_event_template_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_update_request; } @@ -2195,16 +2200,17 @@ public function updateRequest($app_id, $event_template_id, $timeline_event_templ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2524,7 +2530,7 @@ public function update_0Request($app_id, $event_template_id, $token_name, $timel if (isset($timeline_event_template_token_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_token_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_token_update_request; } @@ -2545,16 +2551,17 @@ public function update_0Request($app_id, $event_template_id, $token_name, $timel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Crm/Timeline/Api/BatchApi.php b/codegen/Crm/Timeline/Api/BatchApi.php index 8c68c2bb..ac2d740b 100644 --- a/codegen/Crm/Timeline/Api/BatchApi.php +++ b/codegen/Crm/Timeline/Api/BatchApi.php @@ -374,7 +374,7 @@ public function createBatchRequest($batch_input_timeline_event, string $contentT if (isset($batch_input_timeline_event)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_timeline_event), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_timeline_event; } @@ -395,7 +395,7 @@ public function createBatchRequest($batch_input_timeline_event, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Timeline/Api/EventsApi.php b/codegen/Crm/Timeline/Api/EventsApi.php deleted file mode 100644 index 8cac886b..00000000 --- a/codegen/Crm/Timeline/Api/EventsApi.php +++ /dev/null @@ -1,1672 +0,0 @@ - [ - 'application/json', - ], - 'createBatch' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getDetailById' => [ - 'application/json', - ], - 'getRenderById' => [ - '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 create - * - * Send event data (single) - * - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEvent $timeline_event The timeline event definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function create($timeline_event, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($timeline_event, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Send event data (single) - * - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEvent $timeline_event The timeline event definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($timeline_event, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($timeline_event, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Send event data (single) - * - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEvent $timeline_event The timeline event definition. (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($timeline_event, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($timeline_event, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Send event data (single) - * - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEvent $timeline_event The timeline event definition. (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($timeline_event, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse'; - $request = $this->createRequest($timeline_event, $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\Timeline\Model\TimelineEvent $timeline_event The timeline event definition. (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($timeline_event, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'timeline_event' is set - if ($timeline_event === null || (is_array($timeline_event) && count($timeline_event) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timeline_event when calling create' - ); - } - - - $resourcePath = '/integrators/timeline/v3/events'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($timeline_event)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($timeline_event)); - } else { - $httpBody = $timeline_event; - } - } 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 createBatch - * - * Create multiple events - * - * @param \HubSpot\Client\Crm\Timeline\Model\BatchInputTimelineEvent $batch_input_timeline_event The timeline event definition. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function createBatch($batch_input_timeline_event, string $contentType = self::contentTypes['createBatch'][0]) - { - $this->createBatchWithHttpInfo($batch_input_timeline_event, $contentType); - } - - /** - * Operation createBatchWithHttpInfo - * - * Create multiple events - * - * @param \HubSpot\Client\Crm\Timeline\Model\BatchInputTimelineEvent $batch_input_timeline_event The timeline event definition. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function createBatchWithHttpInfo($batch_input_timeline_event, string $contentType = self::contentTypes['createBatch'][0]) - { - $request = $this->createBatchRequest($batch_input_timeline_event, $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()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\BatchResponseTimelineEventResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\BatchResponseTimelineEventResponseWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createBatchAsync - * - * Create multiple events - * - * @param \HubSpot\Client\Crm\Timeline\Model\BatchInputTimelineEvent $batch_input_timeline_event The timeline event definition. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsync($batch_input_timeline_event, string $contentType = self::contentTypes['createBatch'][0]) - { - return $this->createBatchAsyncWithHttpInfo($batch_input_timeline_event, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createBatchAsyncWithHttpInfo - * - * Create multiple events - * - * @param \HubSpot\Client\Crm\Timeline\Model\BatchInputTimelineEvent $batch_input_timeline_event The timeline event definition. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createBatchAsyncWithHttpInfo($batch_input_timeline_event, string $contentType = self::contentTypes['createBatch'][0]) - { - $returnType = ''; - $request = $this->createBatchRequest($batch_input_timeline_event, $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 'createBatch' - * - * @param \HubSpot\Client\Crm\Timeline\Model\BatchInputTimelineEvent $batch_input_timeline_event The timeline event definition. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createBatchRequest($batch_input_timeline_event, string $contentType = self::contentTypes['createBatch'][0]) - { - - // verify the required parameter 'batch_input_timeline_event' is set - if ($batch_input_timeline_event === null || (is_array($batch_input_timeline_event) && count($batch_input_timeline_event) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_timeline_event when calling createBatch' - ); - } - - - $resourcePath = '/integrators/timeline/v3/events/batch/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_timeline_event)) { - 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_timeline_event)); - } else { - $httpBody = $batch_input_timeline_event; - } - } 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 - * - * Get an event instance - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function getById($event_template_id, $event_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($event_template_id, $event_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get an event instance - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($event_template_id, $event_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($event_template_id, $event_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get an event instance - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (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($event_template_id, $event_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($event_template_id, $event_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get an event instance - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (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($event_template_id, $event_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse'; - $request = $this->getByIdRequest($event_template_id, $event_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 string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (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($event_template_id, $event_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling getById' - ); - } - - // verify the required parameter 'event_id' is set - if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_id when calling getById' - ); - } - - - $resourcePath = '/integrators/timeline/v3/events/{eventTemplateId}/{eventId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // path params - if ($event_id !== null) { - $resourcePath = str_replace( - '{' . 'eventId' . '}', - ObjectSerializer::toPathValue($event_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 getDetailById - * - * Get event details - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetailById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\EventDetail|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function getDetailById($event_template_id, $event_id, string $contentType = self::contentTypes['getDetailById'][0]) - { - list($response) = $this->getDetailByIdWithHttpInfo($event_template_id, $event_id, $contentType); - return $response; - } - - /** - * Operation getDetailByIdWithHttpInfo - * - * Get event details - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetailById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\EventDetail|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getDetailByIdWithHttpInfo($event_template_id, $event_id, string $contentType = self::contentTypes['getDetailById'][0]) - { - $request = $this->getDetailByIdRequest($event_template_id, $event_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\EventDetail', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\EventDetail', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\EventDetail', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getDetailByIdAsync - * - * Get event details - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetailById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getDetailByIdAsync($event_template_id, $event_id, string $contentType = self::contentTypes['getDetailById'][0]) - { - return $this->getDetailByIdAsyncWithHttpInfo($event_template_id, $event_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDetailByIdAsyncWithHttpInfo - * - * Get event details - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetailById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getDetailByIdAsyncWithHttpInfo($event_template_id, $event_id, string $contentType = self::contentTypes['getDetailById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\EventDetail'; - $request = $this->getDetailByIdRequest($event_template_id, $event_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 'getDetailById' - * - * @param string $event_template_id The event template ID. (required) - * @param string $event_id The event ID. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetailById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getDetailByIdRequest($event_template_id, $event_id, string $contentType = self::contentTypes['getDetailById'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling getDetailById' - ); - } - - // verify the required parameter 'event_id' is set - if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_id when calling getDetailById' - ); - } - - - $resourcePath = '/integrators/timeline/v3/events/{eventTemplateId}/{eventId}/detail'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // path params - if ($event_id !== null) { - $resourcePath = str_replace( - '{' . 'eventId' . '}', - ObjectSerializer::toPathValue($event_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 getRenderById - * - * Get event render by ID - * - * @param string $event_id The event ID. (required) - * @param string $event_template_id The event template ID. (required) - * @param bool|null $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return string|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function getRenderById($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0]) - { - list($response) = $this->getRenderByIdWithHttpInfo($event_id, $event_template_id, $detail, $contentType); - return $response; - } - - /** - * Operation getRenderByIdWithHttpInfo - * - * Get event render by ID - * - * @param string $event_id The event ID. (required) - * @param string $event_template_id The event template ID. (required) - * @param bool|null $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRenderById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of string|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getRenderByIdWithHttpInfo($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0]) - { - $request = $this->getRenderByIdRequest($event_id, $event_template_id, $detail, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - 'string', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - 'string', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'string', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getRenderByIdAsync - * - * Get event render by ID - * - * @param string $event_id The event ID. (required) - * @param string $event_template_id The event template ID. (required) - * @param bool|null $detail Set to '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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getRenderByIdAsync($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0]) - { - return $this->getRenderByIdAsyncWithHttpInfo($event_id, $event_template_id, $detail, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getRenderByIdAsyncWithHttpInfo - * - * Get event render by ID - * - * @param string $event_id The event ID. (required) - * @param string $event_template_id The event template ID. (required) - * @param bool|null $detail Set to '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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getRenderByIdAsyncWithHttpInfo($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0]) - { - $returnType = 'string'; - $request = $this->getRenderByIdRequest($event_id, $event_template_id, $detail, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'getRenderById' - * - * @param string $event_id The event ID. (required) - * @param string $event_template_id The event template ID. (required) - * @param bool|null $detail Set to '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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getRenderByIdRequest($event_id, $event_template_id, $detail = null, string $contentType = self::contentTypes['getRenderById'][0]) - { - - // verify the required parameter 'event_id' is set - if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_id when calling getRenderById' - ); - } - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling getRenderById' - ); - } - - - - $resourcePath = '/integrators/timeline/v3/events/{eventTemplateId}/{eventId}/render'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $detail, - 'detail', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($event_id !== null) { - $resourcePath = str_replace( - '{' . 'eventId' . '}', - ObjectSerializer::toPathValue($event_id), - $resourcePath - ); - } - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['text/html', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Timeline/Api/TemplatesApi.php b/codegen/Crm/Timeline/Api/TemplatesApi.php deleted file mode 100644 index d5a4b1ad..00000000 --- a/codegen/Crm/Timeline/Api/TemplatesApi.php +++ /dev/null @@ -1,1686 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - '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 an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($event_template_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($event_template_id, $app_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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\Timeline\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($event_template_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($event_template_id, $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\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($event_template_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($event_template_id, $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 string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling archive' - ); - } - - // 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 = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // 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 - * - * Create an event template - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateCreateRequest $timeline_event_template_create_request The new event template definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function create($app_id, $timeline_event_template_create_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($app_id, $timeline_event_template_create_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create an event template - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateCreateRequest $timeline_event_template_create_request The new event template definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($app_id, $timeline_event_template_create_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($app_id, $timeline_event_template_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create an event template - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateCreateRequest $timeline_event_template_create_request The new event template definition. (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, $timeline_event_template_create_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($app_id, $timeline_event_template_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create an event template - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateCreateRequest $timeline_event_template_create_request The new event template definition. (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, $timeline_event_template_create_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; - $request = $this->createRequest($app_id, $timeline_event_template_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 'create' - * - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateCreateRequest $timeline_event_template_create_request The new event template definition. (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, $timeline_event_template_create_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 'timeline_event_template_create_request' is set - if ($timeline_event_template_create_request === null || (is_array($timeline_event_template_create_request) && count($timeline_event_template_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timeline_event_template_create_request when calling create' - ); - } - - - $resourcePath = '/integrators/timeline/v3/{appId}/event-templates'; - $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($timeline_event_template_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($timeline_event_template_create_request)); - } else { - $httpBody = $timeline_event_template_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 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 getAll - * - * Get all event templates - * - * @param int $app_id The ID of the target app. (required) - * @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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Get all event templates - * - * @param int $app_id The ID of the target app. (required) - * @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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Get all event templates - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Get all event templates - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging'; - $request = $this->getAllRequest($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 'getAll' - * - * @param int $app_id The ID of the target app. (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][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 getAll' - ); - } - - - $resourcePath = '/integrators/timeline/v3/{appId}/event-templates'; - $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 getById - * - * Get an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function getById($event_template_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($event_template_id, $app_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($event_template_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($event_template_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($event_template_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; - $request = $this->getByIdRequest($event_template_id, $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 string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target 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($event_template_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling getById' - ); - } - - // 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 = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // 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 an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateUpdateRequest $timeline_event_template_update_request The updated event template definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function update($event_template_id, $app_id, $timeline_event_template_update_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($event_template_id, $app_id, $timeline_event_template_update_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateUpdateRequest $timeline_event_template_update_request The updated event template definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($event_template_id, $app_id, $timeline_event_template_update_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($event_template_id, $app_id, $timeline_event_template_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateUpdateRequest $timeline_event_template_update_request The updated event template definition. (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($event_template_id, $app_id, $timeline_event_template_update_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($event_template_id, $app_id, $timeline_event_template_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update an event template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateUpdateRequest $timeline_event_template_update_request The updated event template definition. (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($event_template_id, $app_id, $timeline_event_template_update_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; - $request = $this->updateRequest($event_template_id, $app_id, $timeline_event_template_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 'update' - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateUpdateRequest $timeline_event_template_update_request The updated event template definition. (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($event_template_id, $app_id, $timeline_event_template_update_request, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling update' - ); - } - - // 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 'timeline_event_template_update_request' is set - if ($timeline_event_template_update_request === null || (is_array($timeline_event_template_update_request) && count($timeline_event_template_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timeline_event_template_update_request when calling update' - ); - } - - - $resourcePath = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // 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($timeline_event_template_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($timeline_event_template_update_request)); - } else { - $httpBody = $timeline_event_template_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 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( - 'PUT', - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Timeline/Api/TokensApi.php b/codegen/Crm/Timeline/Api/TokensApi.php deleted file mode 100644 index 8c712e31..00000000 --- a/codegen/Crm/Timeline/Api/TokensApi.php +++ /dev/null @@ -1,1146 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - '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 template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target 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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($event_template_id, $token_name, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($event_template_id, $token_name, $app_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target 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\Timeline\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($event_template_id, $token_name, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($event_template_id, $token_name, $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\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target 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($event_template_id, $token_name, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($event_template_id, $token_name, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target 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($event_template_id, $token_name, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($event_template_id, $token_name, $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 string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target 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($event_template_id, $token_name, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling archive' - ); - } - - // verify the required parameter 'token_name' is set - if ($token_name === null || (is_array($token_name) && count($token_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $token_name when calling archive' - ); - } - - // 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 = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}/tokens/{tokenName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // path params - if ($token_name !== null) { - $resourcePath = str_replace( - '{' . 'tokenName' . '}', - ObjectSerializer::toPathValue($token_name), - $resourcePath - ); - } - // 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 - * - * Add tokens to an existing template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken $timeline_event_template_token The new token definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function create($event_template_id, $app_id, $timeline_event_template_token, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($event_template_id, $app_id, $timeline_event_template_token, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Add tokens to an existing template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken $timeline_event_template_token The new token definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($event_template_id, $app_id, $timeline_event_template_token, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($event_template_id, $app_id, $timeline_event_template_token, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Add tokens to an existing template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken $timeline_event_template_token The new token definition. (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($event_template_id, $app_id, $timeline_event_template_token, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($event_template_id, $app_id, $timeline_event_template_token, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Add tokens to an existing template - * - * @param string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken $timeline_event_template_token The new token definition. (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($event_template_id, $app_id, $timeline_event_template_token, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken'; - $request = $this->createRequest($event_template_id, $app_id, $timeline_event_template_token, $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 string $event_template_id The event template ID. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken $timeline_event_template_token The new token definition. (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($event_template_id, $app_id, $timeline_event_template_token, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling create' - ); - } - - // 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 'timeline_event_template_token' is set - if ($timeline_event_template_token === null || (is_array($timeline_event_template_token) && count($timeline_event_template_token) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timeline_event_template_token when calling create' - ); - } - - - $resourcePath = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}/tokens'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // 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($timeline_event_template_token)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_token)); - } else { - $httpBody = $timeline_event_template_token; - } - } 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 update - * - * Update a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateTokenUpdateRequest $timeline_event_template_token_update_request The updated token definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken|\HubSpot\Client\Crm\Timeline\Model\Error - */ - public function update($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateTokenUpdateRequest $timeline_event_template_token_update_request The updated token definition. (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\Timeline\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken|\HubSpot\Client\Crm\Timeline\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($event_template_id, $token_name, $app_id, $timeline_event_template_token_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Timeline\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateTokenUpdateRequest $timeline_event_template_token_update_request The updated token definition. (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($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update a template token - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateTokenUpdateRequest $timeline_event_template_token_update_request The updated token definition. (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($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken'; - $request = $this->updateRequest($event_template_id, $token_name, $app_id, $timeline_event_template_token_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 'update' - * - * @param string $event_template_id The event template ID. (required) - * @param string $token_name The token name. (required) - * @param int $app_id The ID of the target app. (required) - * @param \HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateTokenUpdateRequest $timeline_event_template_token_update_request The updated token definition. (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($event_template_id, $token_name, $app_id, $timeline_event_template_token_update_request, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'event_template_id' is set - if ($event_template_id === null || (is_array($event_template_id) && count($event_template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_template_id when calling update' - ); - } - - // verify the required parameter 'token_name' is set - if ($token_name === null || (is_array($token_name) && count($token_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $token_name when calling update' - ); - } - - // 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 'timeline_event_template_token_update_request' is set - if ($timeline_event_template_token_update_request === null || (is_array($timeline_event_template_token_update_request) && count($timeline_event_template_token_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timeline_event_template_token_update_request when calling update' - ); - } - - - $resourcePath = '/integrators/timeline/v3/{appId}/event-templates/{eventTemplateId}/tokens/{tokenName}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($event_template_id !== null) { - $resourcePath = str_replace( - '{' . 'eventTemplateId' . '}', - ObjectSerializer::toPathValue($event_template_id), - $resourcePath - ); - } - // path params - if ($token_name !== null) { - $resourcePath = str_replace( - '{' . 'tokenName' . '}', - ObjectSerializer::toPathValue($token_name), - $resourcePath - ); - } - // 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($timeline_event_template_token_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($timeline_event_template_token_update_request)); - } else { - $httpBody = $timeline_event_template_token_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 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( - 'PUT', - $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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Crm/Timeline/Model/EventDetail.php b/codegen/Crm/Timeline/Model/EventDetail.php deleted file mode 100644 index a8b5011a..00000000 --- a/codegen/Crm/Timeline/Model/EventDetail.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class EventDetail implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'EventDetail'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'details' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'details' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'details' => 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 = [ - 'details' => 'details' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'details' => 'setDetails' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'details' => 'getDetails' - ]; - - /** - * 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('details', $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['details'] === null) { - $invalidProperties[] = "'details' 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 details - * - * @return string - */ - public function getDetails() - { - return $this->container['details']; - } - - /** - * Sets details - * - * @param string $details The details Markdown rendered as HTML. - * - * @return self - */ - public function setDetails($details) - { - if (is_null($details)) { - throw new \InvalidArgumentException('non-nullable details cannot be null'); - } - $this->container['details'] = $details; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Api/BasicApi.php b/codegen/Events/Api/BasicApi.php index 42ae912e..ec6e5908 100644 --- a/codegen/Events/Api/BasicApi.php +++ b/codegen/Events/Api/BasicApi.php @@ -547,17 +547,13 @@ public function eventsV3EventsRequest($after = null, $before = null, $event_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { @@ -805,17 +801,13 @@ public function eventsV3EventsEventTypesRequest(string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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()) { diff --git a/codegen/Events/Api/EventsApi.php b/codegen/Events/Api/EventsApi.php deleted file mode 100644 index 9e717f67..00000000 --- a/codegen/Events/Api/EventsApi.php +++ /dev/null @@ -1,912 +0,0 @@ - [ - 'application/json', - ], - 'getTypes' => [ - '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 getPage - * - * Retrieve event occurrences - * - * @param string|null $object_type (optional) - * @param string|null $event_type (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 (optional) - * @param \DateTime|null $occurred_after (optional) - * @param \DateTime|null $occurred_before (optional) - * @param int|null $object_id (optional) - * @param object|null $object_property_propname (optional) - * @param object|null $property_propname (optional) - * @param string[]|null $id (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent|\HubSpot\Client\Events\Model\Error - */ - public function getPage($object_type = null, $event_type = null, $after = null, $before = null, $limit = null, $sort = null, $occurred_after = null, $occurred_before = null, $object_id = null, $object_property_propname = null, $property_propname = null, $id = null, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($object_type, $event_type, $after, $before, $limit, $sort, $occurred_after, $occurred_before, $object_id, $object_property_propname, $property_propname, $id, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Retrieve event occurrences - * - * @param string|null $object_type (optional) - * @param string|null $event_type (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 (optional) - * @param \DateTime|null $occurred_after (optional) - * @param \DateTime|null $occurred_before (optional) - * @param int|null $object_id (optional) - * @param object|null $object_property_propname (optional) - * @param object|null $property_propname (optional) - * @param string[]|null $id (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent|\HubSpot\Client\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($object_type = null, $event_type = null, $after = null, $before = null, $limit = null, $sort = null, $occurred_after = null, $occurred_before = null, $object_id = null, $object_property_propname = null, $property_propname = null, $id = null, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($object_type, $event_type, $after, $before, $limit, $sort, $occurred_after, $occurred_before, $object_id, $object_property_propname, $property_propname, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Retrieve event occurrences - * - * @param string|null $object_type (optional) - * @param string|null $event_type (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 (optional) - * @param \DateTime|null $occurred_after (optional) - * @param \DateTime|null $occurred_before (optional) - * @param int|null $object_id (optional) - * @param object|null $object_property_propname (optional) - * @param object|null $property_propname (optional) - * @param string[]|null $id (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($object_type = null, $event_type = null, $after = null, $before = null, $limit = null, $sort = null, $occurred_after = null, $occurred_before = null, $object_id = null, $object_property_propname = null, $property_propname = null, $id = null, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($object_type, $event_type, $after, $before, $limit, $sort, $occurred_after, $occurred_before, $object_id, $object_property_propname, $property_propname, $id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Retrieve event occurrences - * - * @param string|null $object_type (optional) - * @param string|null $event_type (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 (optional) - * @param \DateTime|null $occurred_after (optional) - * @param \DateTime|null $occurred_before (optional) - * @param int|null $object_id (optional) - * @param object|null $object_property_propname (optional) - * @param object|null $property_propname (optional) - * @param string[]|null $id (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($object_type = null, $event_type = null, $after = null, $before = null, $limit = null, $sort = null, $occurred_after = null, $occurred_before = null, $object_id = null, $object_property_propname = null, $property_propname = null, $id = null, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent'; - $request = $this->getPageRequest($object_type, $event_type, $after, $before, $limit, $sort, $occurred_after, $occurred_before, $object_id, $object_property_propname, $property_propname, $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 'getPage' - * - * @param string|null $object_type (optional) - * @param string|null $event_type (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 (optional) - * @param \DateTime|null $occurred_after (optional) - * @param \DateTime|null $occurred_before (optional) - * @param int|null $object_id (optional) - * @param object|null $object_property_propname (optional) - * @param object|null $property_propname (optional) - * @param string[]|null $id (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($object_type = null, $event_type = null, $after = null, $before = null, $limit = null, $sort = null, $occurred_after = null, $occurred_before = null, $object_id = null, $object_property_propname = null, $property_propname = null, $id = null, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - - - - - - - - - $resourcePath = '/events/v3/events/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $object_type, - 'objectType', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $event_type, - 'eventType', // param base name - 'string', // 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( - $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 - ) ?? []); - // 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( - $occurred_after, - 'occurredAfter', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $occurred_before, - 'occurredBefore', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $object_id, - 'objectId', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $object_property_propname, - 'objectProperty.{propname}', // param base name - 'object', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $property_propname, - 'property.{propname}', // param base name - 'object', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id, - 'id', // param base name - 'array', // 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 getTypes - * - * Retrieve event types - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] 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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Events\Model\VisibleExternalEventTypeNames|\HubSpot\Client\Events\Model\Error - */ - public function getTypes(string $contentType = self::contentTypes['getTypes'][0]) - { - list($response) = $this->getTypesWithHttpInfo($contentType); - return $response; - } - - /** - * Operation getTypesWithHttpInfo - * - * Retrieve event types - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] 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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Events\Model\VisibleExternalEventTypeNames|\HubSpot\Client\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getTypesWithHttpInfo(string $contentType = self::contentTypes['getTypes'][0]) - { - $request = $this->getTypesRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getTypesAsync - * - * Retrieve event types - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getTypesAsync(string $contentType = self::contentTypes['getTypes'][0]) - { - return $this->getTypesAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getTypesAsyncWithHttpInfo - * - * Retrieve event types - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getTypesAsyncWithHttpInfo(string $contentType = self::contentTypes['getTypes'][0]) - { - $returnType = '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames'; - $request = $this->getTypesRequest($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 'getTypes' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getTypesRequest(string $contentType = self::contentTypes['getTypes'][0]) - { - - - $resourcePath = '/events/v3/events/event-types'; - $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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Events/Send/Api/BasicApi.php b/codegen/Events/Send/Api/BasicApi.php index c9ada978..02585ec1 100644 --- a/codegen/Events/Send/Api/BasicApi.php +++ b/codegen/Events/Send/Api/BasicApi.php @@ -299,7 +299,7 @@ public function sendRequest($behavioral_event_http_completion_request, string $c if (isset($behavioral_event_http_completion_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($behavioral_event_http_completion_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $behavioral_event_http_completion_request; } @@ -320,7 +320,7 @@ public function sendRequest($behavioral_event_http_completion_request, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Events/Send/Api/BatchApi.php b/codegen/Events/Send/Api/BatchApi.php index ff8e05d9..aa0cd9ee 100644 --- a/codegen/Events/Send/Api/BatchApi.php +++ b/codegen/Events/Send/Api/BatchApi.php @@ -299,7 +299,7 @@ public function sendRequest($batched_behavioral_event_http_completion_request, s 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batched_behavioral_event_http_completion_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batched_behavioral_event_http_completion_request; } @@ -320,7 +320,7 @@ public function sendRequest($batched_behavioral_event_http_completion_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/BasicApi.php b/codegen/Files/Api/BasicApi.php index ba393b5c..fe3e0250 100644 --- a/codegen/Files/Api/BasicApi.php +++ b/codegen/Files/Api/BasicApi.php @@ -358,7 +358,7 @@ public function filesV3FilesFileIdDownloadRequest($file_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/FilesApi.php b/codegen/Files/Api/FilesApi.php index 6e4573e2..24cc93f1 100644 --- a/codegen/Files/Api/FilesApi.php +++ b/codegen/Files/Api/FilesApi.php @@ -357,7 +357,7 @@ public function archiveRequest($file_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -643,7 +643,7 @@ public function checkImportRequest($task_id, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -907,7 +907,7 @@ public function createRequest($folder_input, string $contentType = self::content if (isset($folder_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($folder_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $folder_input; } @@ -928,7 +928,7 @@ public function createRequest($folder_input, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1161,7 +1161,7 @@ public function deleteRequest($file_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1967,7 +1967,7 @@ public function doSearchRequest($after = null, $allows_anonymous_access = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2271,7 +2271,7 @@ public function getByIdRequest($file_id, $properties = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2575,7 +2575,7 @@ public function getMetadataRequest($path, $properties = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2909,7 +2909,7 @@ public function getSignedUrlRequest($file_id, $expiration_seconds = null, $size } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3173,7 +3173,7 @@ public function importFromUrlRequest($import_from_url_input, string $contentType if (isset($import_from_url_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($import_from_url_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $import_from_url_input; } @@ -3194,7 +3194,7 @@ public function importFromUrlRequest($import_from_url_input, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3513,7 +3513,7 @@ public function replaceRequest($file_id, $charset_hunch = null, $file = null, $o } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3800,7 +3800,7 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co if (isset($file_update_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($file_update_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $file_update_input; } @@ -3821,7 +3821,7 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4138,7 +4138,7 @@ public function uploadRequest($charset_hunch = null, $file = null, $file_name = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/FoldersApi.php b/codegen/Files/Api/FoldersApi.php index b28c8ab8..5c64dcc1 100644 --- a/codegen/Files/Api/FoldersApi.php +++ b/codegen/Files/Api/FoldersApi.php @@ -345,7 +345,7 @@ public function archiveRequest($folder_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -578,7 +578,7 @@ public function archiveByPathRequest($folder_path, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -864,7 +864,7 @@ public function checkUpdateStatusRequest($task_id, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1385,7 +1385,7 @@ public function doSearchRequest($after = null, $before = null, $created_at = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1689,7 +1689,7 @@ public function getByIdRequest($folder_id, $properties = null, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1993,7 +1993,7 @@ public function getByPathRequest($folder_path, $properties = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2280,7 +2280,7 @@ public function updatePropertiesRequest($folder_id, $folder_update_input, string if (isset($folder_update_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($folder_update_input), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $folder_update_input; } @@ -2301,7 +2301,7 @@ public function updatePropertiesRequest($folder_id, $folder_update_input, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2565,7 +2565,7 @@ public function updatePropertiesRecursivelyRequest($folder_update_input_with_id, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($folder_update_input_with_id), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $folder_update_input_with_id; } @@ -2586,7 +2586,7 @@ public function updatePropertiesRecursivelyRequest($folder_update_input_with_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Model/StandardError.php b/codegen/Files/Model/StandardError.php index 10282935..41c27c24 100644 --- a/codegen/Files/Model/StandardError.php +++ b/codegen/Files/Model/StandardError.php @@ -532,7 +532,7 @@ public function getStatus() /** * Sets status * - * @param string $status The HTTP status code associated with the error. + * @param string $status A text status code for the error, typically \"error\". * * @return self */ diff --git a/codegen/Marketing/Emails/Api/BasicApi.php b/codegen/Marketing/Emails/Api/BasicApi.php index 97489560..22efe2a9 100644 --- a/codegen/Marketing/Emails/Api/BasicApi.php +++ b/codegen/Marketing/Emails/Api/BasicApi.php @@ -426,7 +426,7 @@ public function getEmailsListRequest($email_ids = null, $end_timestamp = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -752,7 +752,7 @@ public function getHistogramRequest($email_ids = null, $end_timestamp = null, $i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1325,7 +1325,7 @@ public function marketingV3EmailsRequest($after = null, $archived = null, $campa } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1581,7 +1581,7 @@ public function marketingV3Emails_0Request($email_create_request, string $conten if (isset($email_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $email_create_request; } @@ -1602,7 +1602,7 @@ public function marketingV3Emails_0Request($email_create_request, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Emails/Api/EmailsApi.php b/codegen/Marketing/Emails/Api/EmailsApi.php index 0bd95741..2a7fc171 100644 --- a/codegen/Marketing/Emails/Api/EmailsApi.php +++ b/codegen/Marketing/Emails/Api/EmailsApi.php @@ -378,7 +378,7 @@ public function archiveRequest($email_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -642,7 +642,7 @@ public function callCloneRequest($email_clone_request_v_next, string $contentTyp if (isset($email_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_clone_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $email_clone_request_v_next; } @@ -663,7 +663,7 @@ public function callCloneRequest($email_clone_request_v_next, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -927,7 +927,7 @@ public function createAbTestVariationRequest($ab_test_create_request_v_next, str if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -948,7 +948,7 @@ public function createAbTestVariationRequest($ab_test_create_request_v_next, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1324,7 +1324,7 @@ public function getAbTestVariationRequest($email_id, $archived = null, $included } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1700,7 +1700,7 @@ public function getByIdRequest($email_id, $archived = null, $included_properties } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1986,7 +1986,7 @@ public function getDraftRequest($email_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2292,7 +2292,7 @@ public function getRevisionByIdRequest($email_id, $revision_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2623,7 +2623,7 @@ public function getRevisionsRequest($email_id, $after = null, $before = null, $l } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2853,7 +2853,7 @@ public function publishOrSendRequest($email_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3083,7 +3083,7 @@ public function resetDraftRequest($email_id, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3389,7 +3389,7 @@ public function restoreDraftRevisionRequest($email_id, $revision_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3639,7 +3639,7 @@ public function restoreRevisionRequest($email_id, $revision_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3869,7 +3869,7 @@ public function unpublishOrCancelRequest($email_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4168,7 +4168,7 @@ public function updateRequest($email_id, $email_update_request, $archived = null if (isset($email_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $email_update_request; } @@ -4189,7 +4189,7 @@ public function updateRequest($email_id, $email_update_request, $archived = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4473,7 +4473,7 @@ public function upsertDraftRequest($email_id, $email_update_request, string $con if (isset($email_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $email_update_request; } @@ -4494,7 +4494,7 @@ public function upsertDraftRequest($email_id, $email_update_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Emails/Api/StatisticsApi.php b/codegen/Marketing/Emails/Api/StatisticsApi.php deleted file mode 100644 index 502ceab3..00000000 --- a/codegen/Marketing/Emails/Api/StatisticsApi.php +++ /dev/null @@ -1,852 +0,0 @@ - [ - 'application/json', - ], - 'getHistogram' => [ - '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 getEmailsList - * - * Get aggregated statistics - * - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics|\HubSpot\Client\Marketing\Emails\Model\Error - */ - public function getEmailsList($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) - { - list($response) = $this->getEmailsListWithHttpInfo($start_timestamp, $end_timestamp, $email_ids, $property, $contentType); - return $response; - } - - /** - * Operation getEmailsListWithHttpInfo - * - * Get aggregated statistics - * - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getEmailsListWithHttpInfo($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) - { - $request = $this->getEmailsListRequest($start_timestamp, $end_timestamp, $email_ids, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Emails\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getEmailsListAsync - * - * Get aggregated statistics - * - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getEmailsListAsync($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) - { - return $this->getEmailsListAsyncWithHttpInfo($start_timestamp, $end_timestamp, $email_ids, $property, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getEmailsListAsyncWithHttpInfo - * - * Get aggregated statistics - * - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getEmailsListAsyncWithHttpInfo($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Emails\Model\AggregateEmailStatistics'; - $request = $this->getEmailsListRequest($start_timestamp, $end_timestamp, $email_ids, $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 'getEmailsList' - * - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string|null $property Specifies which email properties should be returned. All properties will be returned by default. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getEmailsListRequest($start_timestamp = null, $end_timestamp = null, $email_ids = null, $property = null, string $contentType = self::contentTypes['getEmailsList'][0]) - { - - - - - - - $resourcePath = '/marketing/v3/emails/statistics/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $start_timestamp, - 'startTimestamp', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end_timestamp, - 'endTimestamp', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $email_ids, - 'emailIds', // param base name - 'array', // 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 getHistogram - * - * Get aggregated statistic intervals - * - * @param string|null $interval The interval to aggregate statistics for. (optional) - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging|\HubSpot\Client\Marketing\Emails\Model\Error - */ - public function getHistogram($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) - { - list($response) = $this->getHistogramWithHttpInfo($interval, $start_timestamp, $end_timestamp, $email_ids, $contentType); - return $response; - } - - /** - * Operation getHistogramWithHttpInfo - * - * Get aggregated statistic intervals - * - * @param string|null $interval The interval to aggregate statistics for. (optional) - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Emails\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging|\HubSpot\Client\Marketing\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getHistogramWithHttpInfo($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) - { - $request = $this->getHistogramRequest($interval, $start_timestamp, $end_timestamp, $email_ids, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Emails\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getHistogramAsync - * - * Get aggregated statistic intervals - * - * @param string|null $interval The interval to aggregate statistics for. (optional) - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getHistogramAsync($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) - { - return $this->getHistogramAsyncWithHttpInfo($interval, $start_timestamp, $end_timestamp, $email_ids, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getHistogramAsyncWithHttpInfo - * - * Get aggregated statistic intervals - * - * @param string|null $interval The interval to aggregate statistics for. (optional) - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getHistogramAsyncWithHttpInfo($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Emails\Model\CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; - $request = $this->getHistogramRequest($interval, $start_timestamp, $end_timestamp, $email_ids, $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 'getHistogram' - * - * @param string|null $interval The interval to aggregate statistics for. (optional) - * @param string|null $start_timestamp The start timestamp of the time span, in ISO8601 representation. (optional) - * @param string|null $end_timestamp The end timestamp of the time span, in ISO8601 representation. (optional) - * @param int[]|null $email_ids Filter by email IDs. Only include statistics of emails with these IDs. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHistogram'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getHistogramRequest($interval = null, $start_timestamp = null, $end_timestamp = null, $email_ids = null, string $contentType = self::contentTypes['getHistogram'][0]) - { - - - - - - - $resourcePath = '/marketing/v3/emails/statistics/histogram'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // 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_timestamp, - 'startTimestamp', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end_timestamp, - 'endTimestamp', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $email_ids, - 'emailIds', // param base name - 'array', // 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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php deleted file mode 100644 index 07409776..00000000 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalEmailStatisticIntervalNoPaging.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class CollectionResponseWithTotalEmailStatisticIntervalNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalEmailStatisticIntervalNoPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Marketing\Emails\Model\EmailStatisticInterval[]', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'results' => null, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Marketing\Emails\Model\EmailStatisticInterval[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Marketing\Emails\Model\EmailStatisticInterval[] $results Collection of emails. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of content emails. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php deleted file mode 100644 index 26016e6f..00000000 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalPublicEmailForwardPaging.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class CollectionResponseWithTotalPublicEmailForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalPublicEmailForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Marketing\Emails\Model\ForwardPaging', - 'results' => '\HubSpot\Client\Marketing\Emails\Model\PublicEmail[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Emails\Model\ForwardPaging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Marketing\Emails\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\Emails\Model\PublicEmail[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Marketing\Emails\Model\PublicEmail[] $results Collection of emails. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of content emails. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php b/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php deleted file mode 100644 index 103ef30a..00000000 --- a/codegen/Marketing/Emails/Model/CollectionResponseWithTotalVersionPublicEmail.php +++ /dev/null @@ -1,484 +0,0 @@ - - */ -class CollectionResponseWithTotalVersionPublicEmail implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalVersionPublicEmail'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Marketing\Emails\Model\Paging', - 'results' => '\HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Emails\Model\Paging|null - */ - public function getPaging() - { - return $this->container['paging']; - } - - /** - * Sets paging - * - * @param \HubSpot\Client\Marketing\Emails\Model\Paging|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\Emails\Model\VersionPublicEmail[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Marketing\Emails\Model\VersionPublicEmail[] $results Collection of emails. - * - * @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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total number of content emails. - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Emails/Model/ForwardPaging.php b/codegen/Marketing/Emails/Model/ForwardPaging.php deleted file mode 100644 index 7d7546c2..00000000 --- a/codegen/Marketing/Emails/Model/ForwardPaging.php +++ /dev/null @@ -1,409 +0,0 @@ - - */ -class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ForwardPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'next' => '\HubSpot\Client\Marketing\Emails\Model\NextPage' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'next' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'next' => 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 = [ - 'next' => 'next' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'next' => 'setNext' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'next' => 'getNext' - ]; - - /** - * 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('next', $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 next - * - * @return \HubSpot\Client\Marketing\Emails\Model\NextPage|null - */ - public function getNext() - { - return $this->container['next']; - } - - /** - * Sets next - * - * @param \HubSpot\Client\Marketing\Emails\Model\NextPage|null $next next - * - * @return self - */ - public function setNext($next) - { - if (is_null($next)) { - throw new \InvalidArgumentException('non-nullable next cannot be null'); - } - $this->container['next'] = $next; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Api/BasicApi.php b/codegen/Marketing/Events/Api/BasicApi.php index e61bfc96..e077c8db 100644 --- a/codegen/Marketing/Events/Api/BasicApi.php +++ b/codegen/Marketing/Events/Api/BasicApi.php @@ -366,7 +366,7 @@ public function archiveRequest($external_event_id, $external_account_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function archiveByObjectIdRequest($object_id, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -860,7 +860,7 @@ public function createRequest($marketing_event_create_request_params, string $co 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 = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_create_request_params; } @@ -881,7 +881,7 @@ public function createRequest($marketing_event_create_request_params, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1167,7 +1167,7 @@ public function getByObjectIdRequest($object_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1474,7 +1474,7 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1762,7 +1762,7 @@ public function marketingMarketingEventsV3Request($after = null, $limit = 10, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2067,7 +2067,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi 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 = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_update_request_params; } @@ -2088,7 +2088,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2372,7 +2372,7 @@ public function updateByObjectIdRequest($object_id, $marketing_event_public_upda 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 = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_public_update_request_v2), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_public_update_request_v2; } @@ -2393,7 +2393,7 @@ public function updateByObjectIdRequest($object_id, $marketing_event_public_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2677,7 +2677,7 @@ public function upsertRequest($external_event_id, $marketing_event_create_reques 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 = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_create_request_params; } @@ -2698,7 +2698,7 @@ public function upsertRequest($external_event_id, $marketing_event_create_reques } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/BatchApi.php b/codegen/Marketing/Events/Api/BatchApi.php index a83f471e..f1862f2f 100644 --- a/codegen/Marketing/Events/Api/BatchApi.php +++ b/codegen/Marketing/Events/Api/BatchApi.php @@ -350,7 +350,7 @@ public function archiveRequest($batch_input_marketing_event_external_unique_iden 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_external_unique_identifier; } @@ -371,7 +371,7 @@ public function archiveRequest($batch_input_marketing_event_external_unique_iden } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -621,7 +621,7 @@ public function archiveByObjectIdRequest($batch_input_marketing_event_public_obj 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_object_id_delete_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_public_object_id_delete_request; } @@ -642,7 +642,7 @@ public function archiveByObjectIdRequest($batch_input_marketing_event_public_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -920,7 +920,7 @@ public function updateByObjectIdRequest($batch_input_marketing_event_public_upda 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_update_request_full_v2), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_public_update_request_full_v2; } @@ -941,7 +941,7 @@ public function updateByObjectIdRequest($batch_input_marketing_event_public_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1205,7 +1205,7 @@ public function upsertRequest($batch_input_marketing_event_create_request_params 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_create_request_params; } @@ -1226,7 +1226,7 @@ public function upsertRequest($batch_input_marketing_event_create_request_params } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/EventAttendeesApi.php b/codegen/Marketing/Events/Api/EventAttendeesApi.php index b6a8ef8a..63f1195a 100644 --- a/codegen/Marketing/Events/Api/EventAttendeesApi.php +++ b/codegen/Marketing/Events/Api/EventAttendeesApi.php @@ -419,7 +419,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -440,7 +440,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -744,7 +744,7 @@ public function recordByContactIdRequest($object_id, $subscriber_state, $batch_i 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -765,7 +765,7 @@ public function recordByContactIdRequest($object_id, $subscriber_state, $batch_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1084,7 +1084,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -1105,7 +1105,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function recordByEmailRequest($object_id, $subscriber_state, $batch_input 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -1430,7 +1430,7 @@ public function recordByEmailRequest($object_id, $subscriber_state, $batch_input } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/EventStatusApi.php b/codegen/Marketing/Events/Api/EventStatusApi.php index e760979d..c4c5eca5 100644 --- a/codegen/Marketing/Events/Api/EventStatusApi.php +++ b/codegen/Marketing/Events/Api/EventStatusApi.php @@ -401,7 +401,7 @@ public function cancelRequest($external_event_id, $external_account_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -706,7 +706,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke 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 = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_complete_request_params; } @@ -727,7 +727,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/IdentifiersApi.php b/codegen/Marketing/Events/Api/IdentifiersApi.php index 6a35b6a7..4f84e524 100644 --- a/codegen/Marketing/Events/Api/IdentifiersApi.php +++ b/codegen/Marketing/Events/Api/IdentifiersApi.php @@ -381,7 +381,7 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -667,7 +667,7 @@ public function searchPortalEventsRequest($external_event_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/ListAssociationsApi.php b/codegen/Marketing/Events/Api/ListAssociationsApi.php index d0a6ecf2..0dd1ecda 100644 --- a/codegen/Marketing/Events/Api/ListAssociationsApi.php +++ b/codegen/Marketing/Events/Api/ListAssociationsApi.php @@ -376,7 +376,7 @@ public function associateByExternalAccountAndEventIdsRequest($external_account_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -626,7 +626,7 @@ public function associateByMarketingEventIdRequest($list_id, $marketing_event_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -896,7 +896,7 @@ public function disassociateByExternalAccountAndEventIdsRequest($external_accoun } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1146,7 +1146,7 @@ public function disassociateByMarketingEventIdRequest($list_id, $marketing_event } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1452,7 +1452,7 @@ public function getAllByExternalAccountAndEventIdsRequest($external_account_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1738,7 +1738,7 @@ public function getAllByMarketingEventIdRequest($marketing_event_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/ParticipantStateApi.php b/codegen/Marketing/Events/Api/ParticipantStateApi.php index be205bd2..76ada785 100644 --- a/codegen/Marketing/Events/Api/ParticipantStateApi.php +++ b/codegen/Marketing/Events/Api/ParticipantStateApi.php @@ -434,7 +434,7 @@ public function getParticipationsBreakdownByContactIdRequest($contact_identifier } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -800,7 +800,7 @@ public function getParticipationsBreakdownByExternalEventIdRequest($external_acc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1146,7 +1146,7 @@ public function getParticipationsBreakdownByMarketingEventIdRequest($marketing_e } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1452,7 +1452,7 @@ public function getParticipationsCountersByEventExternalIdRequest($external_acco } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1738,7 +1738,7 @@ public function getParticipationsCountersByMarketingEventIdRequest($marketing_ev } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/SettingsApi.php b/codegen/Marketing/Events/Api/SettingsApi.php index 8912f46b..89198f44 100644 --- a/codegen/Marketing/Events/Api/SettingsApi.php +++ b/codegen/Marketing/Events/Api/SettingsApi.php @@ -380,16 +380,17 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -664,7 +665,7 @@ public function updateRequest($app_id, $event_detail_settings_url, string $conte if (isset($event_detail_settings_url)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($event_detail_settings_url), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $event_detail_settings_url; } @@ -685,16 +686,17 @@ public function updateRequest($app_id, $event_detail_settings_url, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php index fc822659..c925a46d 100644 --- a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php @@ -405,7 +405,7 @@ public function upsertByContactEmailRequest($external_event_id, $subscriber_stat 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -426,7 +426,7 @@ public function upsertByContactEmailRequest($external_event_id, $subscriber_stat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -737,7 +737,7 @@ public function upsertByContactIdRequest($external_event_id, $subscriber_state, 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 = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -758,7 +758,7 @@ public function upsertByContactIdRequest($external_event_id, $subscriber_state, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php deleted file mode 100644 index 2392bb8e..00000000 --- a/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -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 = [ - 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[]', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'results' => null, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\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; - } - - /** - * Gets total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total amount of elements - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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 deleted file mode 100644 index e5aba489..00000000 --- a/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php +++ /dev/null @@ -1,483 +0,0 @@ - - */ -class CollectionResponseWithTotalParticipationBreakdownForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalParticipationBreakdownForwardPaging'; - - /** - * 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\ParticipationBreakdown[]', - 'total' => 'int' - ]; - - /** - * 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, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'paging' => false, - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'paging' => 'setPaging', - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'paging' => 'getPaging', - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\ParticipationBreakdown[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Marketing\Events\Model\ParticipationBreakdown[] $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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total amount of elements - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/CollectionResponseWithTotalPublicListNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php deleted file mode 100644 index 7543c430..00000000 --- a/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -class CollectionResponseWithTotalPublicListNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CollectionResponseWithTotalPublicListNoPaging'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Marketing\Events\Model\PublicList[]', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'results' => null, - 'total' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'results' => false, - 'total' => 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', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'results' => 'setResults', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'results' => 'getResults', - 'total' => 'getTotal' - ]; - - /** - * 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); - $this->setIfExists('total', $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"; - } - if ($this->container['total'] === null) { - $invalidProperties[] = "'total' 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\Marketing\Events\Model\PublicList[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Marketing\Events\Model\PublicList[] $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 total - * - * @return int - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int $total Total amount of elements - * - * @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; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Forms/Api/BasicApi.php b/codegen/Marketing/Forms/Api/BasicApi.php index 61997c4e..431582f6 100644 --- a/codegen/Marketing/Forms/Api/BasicApi.php +++ b/codegen/Marketing/Forms/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($form_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function getByIdRequest($form_id, $archived = null, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -955,7 +955,7 @@ public function marketingV3FormsRequest($after = null, $archived = null, $form_t } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function marketingV3Forms_0Request($body, string $contentType = self::con if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1232,7 +1232,7 @@ public function marketingV3Forms_0Request($body, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1516,7 +1516,7 @@ public function replaceRequest($form_id, $hub_spot_form_definition, string $cont if (isset($hub_spot_form_definition)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_spot_form_definition), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_spot_form_definition; } @@ -1537,7 +1537,7 @@ public function replaceRequest($form_id, $hub_spot_form_definition, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1821,7 +1821,7 @@ public function updateRequest($form_id, $hub_spot_form_definition_patch_request, if (isset($hub_spot_form_definition_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_spot_form_definition_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $hub_spot_form_definition_patch_request; } @@ -1842,7 +1842,7 @@ public function updateRequest($form_id, $hub_spot_form_definition_patch_request, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Forms/Api/FormsApi.php b/codegen/Marketing/Forms/Api/FormsApi.php deleted file mode 100644 index 2cfbebd7..00000000 --- a/codegen/Marketing/Forms/Api/FormsApi.php +++ /dev/null @@ -1,1964 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'getPage' => [ - 'application/json', - ], - 'replace' => [ - '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 - * - * Archive a form definition - * - * @param string $form_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\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($form_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($form_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Archive a form definition - * - * @param string $form_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\Marketing\Forms\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($form_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($form_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\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Archive a form definition - * - * @param string $form_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($form_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($form_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Archive a form definition - * - * @param string $form_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($form_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($form_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 $form_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($form_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'form_id' is set - if ($form_id === null || (is_array($form_id) && count($form_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $form_id when calling archive' - ); - } - - - $resourcePath = '/marketing/v3/forms/{formId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($form_id !== null) { - $resourcePath = str_replace( - '{' . 'formId' . '}', - ObjectSerializer::toPathValue($form_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 a form - * - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionCreateRequest $body body (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\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error - */ - public function create($body, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($body, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create a form - * - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionCreateRequest $body (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\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($body, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($body, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a form - * - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionCreateRequest $body (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($body, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a form - * - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionCreateRequest $body (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($body, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition'; - $request = $this->createRequest($body, $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\Forms\Model\HubSpotFormDefinitionCreateRequest $body (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($body, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'body' is set - if ($body === null || (is_array($body) && count($body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $body when calling create' - ); - } - - - $resourcePath = '/marketing/v3/forms/'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); - } else { - $httpBody = $body; - } - } 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 - * - * Get a form definition - * - * @param string $form_id (required) - * @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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error - */ - public function getById($form_id, $archived = null, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($form_id, $archived, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Get a form definition - * - * @param string $form_id (required) - * @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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($form_id, $archived = null, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($form_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Get a form definition - * - * @param string $form_id (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsync($form_id, $archived = null, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($form_id, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Get a form definition - * - * @param string $form_id (required) - * @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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsyncWithHttpInfo($form_id, $archived = null, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition'; - $request = $this->getByIdRequest($form_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 'getById' - * - * @param string $form_id (required) - * @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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByIdRequest($form_id, $archived = null, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'form_id' is set - if ($form_id === null || (is_array($form_id) && count($form_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $form_id when calling getById' - ); - } - - - - $resourcePath = '/marketing/v3/forms/{formId}'; - $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 - if ($form_id !== null) { - $resourcePath = str_replace( - '{' . 'formId' . '}', - ObjectSerializer::toPathValue($form_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 a list of forms - * - * @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 (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging|\HubSpot\Client\Marketing\Forms\Model\Error - */ - public function getPage($after = null, $limit = null, $archived = null, $form_types = null, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($after, $limit, $archived, $form_types, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get a list of forms - * - * @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 (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging|\HubSpot\Client\Marketing\Forms\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($after = null, $limit = null, $archived = null, $form_types = null, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($after, $limit, $archived, $form_types, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get a list of forms - * - * @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 (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($after = null, $limit = null, $archived = null, $form_types = null, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($after, $limit, $archived, $form_types, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get a list of forms - * - * @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 (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($after = null, $limit = null, $archived = null, $form_types = null, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging'; - $request = $this->getPageRequest($after, $limit, $archived, $form_types, $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 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 (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($after = null, $limit = null, $archived = null, $form_types = null, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - $resourcePath = '/marketing/v3/forms/'; - $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( - $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( - $form_types, - 'formTypes', // param base name - 'array', // 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 replace - * - * Update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition $hub_spot_form_definition hub_spot_form_definition (required) - * @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\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error - */ - public function replace($form_id, $hub_spot_form_definition, string $contentType = self::contentTypes['replace'][0]) - { - list($response) = $this->replaceWithHttpInfo($form_id, $hub_spot_form_definition, $contentType); - return $response; - } - - /** - * Operation replaceWithHttpInfo - * - * Update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition $hub_spot_form_definition (required) - * @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\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function replaceWithHttpInfo($form_id, $hub_spot_form_definition, string $contentType = self::contentTypes['replace'][0]) - { - $request = $this->replaceRequest($form_id, $hub_spot_form_definition, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation replaceAsync - * - * Update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition $hub_spot_form_definition (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsync($form_id, $hub_spot_form_definition, string $contentType = self::contentTypes['replace'][0]) - { - return $this->replaceAsyncWithHttpInfo($form_id, $hub_spot_form_definition, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation replaceAsyncWithHttpInfo - * - * Update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition $hub_spot_form_definition (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function replaceAsyncWithHttpInfo($form_id, $hub_spot_form_definition, string $contentType = self::contentTypes['replace'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition'; - $request = $this->replaceRequest($form_id, $hub_spot_form_definition, $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 'replace' - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition $hub_spot_form_definition (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function replaceRequest($form_id, $hub_spot_form_definition, string $contentType = self::contentTypes['replace'][0]) - { - - // verify the required parameter 'form_id' is set - if ($form_id === null || (is_array($form_id) && count($form_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $form_id when calling replace' - ); - } - - // verify the required parameter 'hub_spot_form_definition' is set - if ($hub_spot_form_definition === null || (is_array($hub_spot_form_definition) && count($hub_spot_form_definition) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $hub_spot_form_definition when calling replace' - ); - } - - - $resourcePath = '/marketing/v3/forms/{formId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($form_id !== null) { - $resourcePath = str_replace( - '{' . 'formId' . '}', - ObjectSerializer::toPathValue($form_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($hub_spot_form_definition)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($hub_spot_form_definition)); - } else { - $httpBody = $hub_spot_form_definition; - } - } 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 update - * - * Partially update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionPatchRequest $hub_spot_form_definition_patch_request hub_spot_form_definition_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\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error - */ - public function update($form_id, $hub_spot_form_definition_patch_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($form_id, $hub_spot_form_definition_patch_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Partially update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionPatchRequest $hub_spot_form_definition_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\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition|\HubSpot\Client\Marketing\Forms\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($form_id, $hub_spot_form_definition_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($form_id, $hub_spot_form_definition_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Forms\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Partially update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionPatchRequest $hub_spot_form_definition_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($form_id, $hub_spot_form_definition_patch_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($form_id, $hub_spot_form_definition_patch_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Partially update a form definition - * - * @param string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionPatchRequest $hub_spot_form_definition_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($form_id, $hub_spot_form_definition_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinition'; - $request = $this->updateRequest($form_id, $hub_spot_form_definition_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 string $form_id (required) - * @param \HubSpot\Client\Marketing\Forms\Model\HubSpotFormDefinitionPatchRequest $hub_spot_form_definition_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($form_id, $hub_spot_form_definition_patch_request, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'form_id' is set - if ($form_id === null || (is_array($form_id) && count($form_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $form_id when calling update' - ); - } - - // verify the required parameter 'hub_spot_form_definition_patch_request' is set - if ($hub_spot_form_definition_patch_request === null || (is_array($hub_spot_form_definition_patch_request) && count($hub_spot_form_definition_patch_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $hub_spot_form_definition_patch_request when calling update' - ); - } - - - $resourcePath = '/marketing/v3/forms/{formId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($form_id !== null) { - $resourcePath = str_replace( - '{' . 'formId' . '}', - ObjectSerializer::toPathValue($form_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($hub_spot_form_definition_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($hub_spot_form_definition_patch_request)); - } else { - $httpBody = $hub_spot_form_definition_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 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( - '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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php deleted file mode 100644 index 895570a0..00000000 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php +++ /dev/null @@ -1,773 +0,0 @@ - - */ -class HubSpotFormDefinitionAllOfLegalConsentOptions implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'HubSpotFormDefinition_allOf_legalConsentOptions'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'lawful_basis' => 'string', - 'privacy_text' => 'string', - 'subscription_type_ids' => 'int[]', - 'communication_consent_text' => 'string', - 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', - 'consent_to_process_checkbox_label' => 'string', - 'consent_to_process_footer_text' => 'string', - 'consent_to_process_text' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'lawful_basis' => null, - 'privacy_text' => null, - 'subscription_type_ids' => 'int64', - 'communication_consent_text' => null, - 'communications_checkboxes' => null, - 'consent_to_process_checkbox_label' => null, - 'consent_to_process_footer_text' => null, - 'consent_to_process_text' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'lawful_basis' => false, - 'privacy_text' => false, - 'subscription_type_ids' => false, - 'communication_consent_text' => false, - 'communications_checkboxes' => false, - 'consent_to_process_checkbox_label' => false, - 'consent_to_process_footer_text' => false, - 'consent_to_process_text' => 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' => 'type', - 'lawful_basis' => 'lawfulBasis', - 'privacy_text' => 'privacyText', - 'subscription_type_ids' => 'subscriptionTypeIds', - 'communication_consent_text' => 'communicationConsentText', - 'communications_checkboxes' => 'communicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'consentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'consentToProcessFooterText', - 'consent_to_process_text' => 'consentToProcessText' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'lawful_basis' => 'setLawfulBasis', - 'privacy_text' => 'setPrivacyText', - 'subscription_type_ids' => 'setSubscriptionTypeIds', - 'communication_consent_text' => 'setCommunicationConsentText', - 'communications_checkboxes' => 'setCommunicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'setConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'setConsentToProcessFooterText', - 'consent_to_process_text' => 'setConsentToProcessText' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'lawful_basis' => 'getLawfulBasis', - 'privacy_text' => 'getPrivacyText', - 'subscription_type_ids' => 'getSubscriptionTypeIds', - 'communication_consent_text' => 'getCommunicationConsentText', - 'communications_checkboxes' => 'getCommunicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'getConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'getConsentToProcessFooterText', - 'consent_to_process_text' => 'getConsentToProcessText' - ]; - - /** - * 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 TYPE_NONE = 'none'; - public const TYPE_LEGITIMATE_INTEREST = 'legitimate_interest'; - public const TYPE_EXPLICIT_CONSENT_TO_PROCESS = 'explicit_consent_to_process'; - public const TYPE_IMPLICIT_CONSENT_TO_PROCESS = 'implicit_consent_to_process'; - public const LAWFUL_BASIS_CLIENT = 'client'; - public const LAWFUL_BASIS_LEAD = 'lead'; - public const LAWFUL_BASIS_OTHER = 'other'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_NONE, - self::TYPE_LEGITIMATE_INTEREST, - self::TYPE_EXPLICIT_CONSENT_TO_PROCESS, - self::TYPE_IMPLICIT_CONSENT_TO_PROCESS, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getLawfulBasisAllowableValues() - { - return [ - self::LAWFUL_BASIS_CLIENT, - self::LAWFUL_BASIS_LEAD, - self::LAWFUL_BASIS_OTHER, - ]; - } - - /** - * 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', $data ?? [], 'none'); - $this->setIfExists('lawful_basis', $data ?? [], null); - $this->setIfExists('privacy_text', $data ?? [], null); - $this->setIfExists('subscription_type_ids', $data ?? [], null); - $this->setIfExists('communication_consent_text', $data ?? [], null); - $this->setIfExists('communications_checkboxes', $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); - - // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; - } - - /** - * 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'] === 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['lawful_basis'] === null) { - $invalidProperties[] = "'lawful_basis' can't be null"; - } - $allowedValues = $this->getLawfulBasisAllowableValues(); - if (!is_null($this->container['lawful_basis']) && !in_array($this->container['lawful_basis'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'lawful_basis', must be one of '%s'", - $this->container['lawful_basis'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['privacy_text'] === null) { - $invalidProperties[] = "'privacy_text' can't be null"; - } - if ($this->container['subscription_type_ids'] === null) { - $invalidProperties[] = "'subscription_type_ids' can't be null"; - } - if ($this->container['communications_checkboxes'] === null) { - $invalidProperties[] = "'communications_checkboxes' 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 - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The legal consent type. Set to \"none\" to indicate no legal consent configuration is required for this form. - * - * @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 lawful_basis - * - * @return string - */ - public function getLawfulBasis() - { - return $this->container['lawful_basis']; - } - - /** - * Sets lawful_basis - * - * @param string $lawful_basis The lawful basis for data processing under legitimate interest. Values: lead (processing for lead generation), client (processing for existing clients), other (other legitimate interests). Default: lead. - * - * @return self - */ - public function setLawfulBasis($lawful_basis) - { - if (is_null($lawful_basis)) { - throw new \InvalidArgumentException('non-nullable lawful_basis cannot be null'); - } - $allowedValues = $this->getLawfulBasisAllowableValues(); - if (!in_array($lawful_basis, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'lawful_basis', must be one of '%s'", - $lawful_basis, - implode("', '", $allowedValues) - ) - ); - } - $this->container['lawful_basis'] = $lawful_basis; - - return $this; - } - - /** - * Gets privacy_text - * - * @return string - */ - public function getPrivacyText() - { - return $this->container['privacy_text']; - } - - /** - * Sets privacy_text - * - * @param string $privacy_text Text explaining the privacy policy and data handling practices. - * - * @return self - */ - public function setPrivacyText($privacy_text) - { - if (is_null($privacy_text)) { - throw new \InvalidArgumentException('non-nullable privacy_text cannot be null'); - } - $this->container['privacy_text'] = $privacy_text; - - return $this; - } - - /** - * Gets subscription_type_ids - * - * @return int[] - */ - public function getSubscriptionTypeIds() - { - return $this->container['subscription_type_ids']; - } - - /** - * Sets subscription_type_ids - * - * @param int[] $subscription_type_ids subscription_type_ids - * - * @return self - */ - public function setSubscriptionTypeIds($subscription_type_ids) - { - if (is_null($subscription_type_ids)) { - throw new \InvalidArgumentException('non-nullable subscription_type_ids cannot be null'); - } - $this->container['subscription_type_ids'] = $subscription_type_ids; - - 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 Text explaining communication consent preferences. - * - * @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 - * - * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] - */ - public function getCommunicationsCheckboxes() - { - return $this->container['communications_checkboxes']; - } - - /** - * Sets communications_checkboxes - * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes - * - * @return self - */ - public function setCommunicationsCheckboxes($communications_checkboxes) - { - if (is_null($communications_checkboxes)) { - throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); - } - $this->container['communications_checkboxes'] = $communications_checkboxes; - - return $this; - } - - /** - * Gets consent_to_process_checkbox_label - * - * @return string|null - */ - public function getConsentToProcessCheckboxLabel() - { - return $this->container['consent_to_process_checkbox_label']; - } - - /** - * Sets consent_to_process_checkbox_label - * - * @param string|null $consent_to_process_checkbox_label Label text for the consent to process checkbox. - * - * @return self - */ - public function setConsentToProcessCheckboxLabel($consent_to_process_checkbox_label) - { - if (is_null($consent_to_process_checkbox_label)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_checkbox_label cannot be null'); - } - $this->container['consent_to_process_checkbox_label'] = $consent_to_process_checkbox_label; - - return $this; - } - - /** - * Gets consent_to_process_footer_text - * - * @return string|null - */ - public function getConsentToProcessFooterText() - { - return $this->container['consent_to_process_footer_text']; - } - - /** - * Sets consent_to_process_footer_text - * - * @param string|null $consent_to_process_footer_text Footer text for the consent to process section. - * - * @return self - */ - public function setConsentToProcessFooterText($consent_to_process_footer_text) - { - 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_footer_text'] = $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 Text explaining the consent to process personal data. - * - * @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. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php deleted file mode 100644 index dadc715c..00000000 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php +++ /dev/null @@ -1,773 +0,0 @@ - - */ -class HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = 'type'; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'HubSpotFormDefinitionCreateRequest_allOf_legalConsentOptions'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'lawful_basis' => 'string', - 'privacy_text' => 'string', - 'subscription_type_ids' => 'int[]', - 'communication_consent_text' => 'string', - 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', - 'consent_to_process_checkbox_label' => 'string', - 'consent_to_process_footer_text' => 'string', - 'consent_to_process_text' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'lawful_basis' => null, - 'privacy_text' => null, - 'subscription_type_ids' => 'int64', - 'communication_consent_text' => null, - 'communications_checkboxes' => null, - 'consent_to_process_checkbox_label' => null, - 'consent_to_process_footer_text' => null, - 'consent_to_process_text' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'lawful_basis' => false, - 'privacy_text' => false, - 'subscription_type_ids' => false, - 'communication_consent_text' => false, - 'communications_checkboxes' => false, - 'consent_to_process_checkbox_label' => false, - 'consent_to_process_footer_text' => false, - 'consent_to_process_text' => 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' => 'type', - 'lawful_basis' => 'lawfulBasis', - 'privacy_text' => 'privacyText', - 'subscription_type_ids' => 'subscriptionTypeIds', - 'communication_consent_text' => 'communicationConsentText', - 'communications_checkboxes' => 'communicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'consentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'consentToProcessFooterText', - 'consent_to_process_text' => 'consentToProcessText' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'lawful_basis' => 'setLawfulBasis', - 'privacy_text' => 'setPrivacyText', - 'subscription_type_ids' => 'setSubscriptionTypeIds', - 'communication_consent_text' => 'setCommunicationConsentText', - 'communications_checkboxes' => 'setCommunicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'setConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'setConsentToProcessFooterText', - 'consent_to_process_text' => 'setConsentToProcessText' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'lawful_basis' => 'getLawfulBasis', - 'privacy_text' => 'getPrivacyText', - 'subscription_type_ids' => 'getSubscriptionTypeIds', - 'communication_consent_text' => 'getCommunicationConsentText', - 'communications_checkboxes' => 'getCommunicationsCheckboxes', - 'consent_to_process_checkbox_label' => 'getConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'getConsentToProcessFooterText', - 'consent_to_process_text' => 'getConsentToProcessText' - ]; - - /** - * 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 TYPE_NONE = 'none'; - public const TYPE_LEGITIMATE_INTEREST = 'legitimate_interest'; - public const TYPE_EXPLICIT_CONSENT_TO_PROCESS = 'explicit_consent_to_process'; - public const TYPE_IMPLICIT_CONSENT_TO_PROCESS = 'implicit_consent_to_process'; - public const LAWFUL_BASIS_CLIENT = 'client'; - public const LAWFUL_BASIS_LEAD = 'lead'; - public const LAWFUL_BASIS_OTHER = 'other'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getTypeAllowableValues() - { - return [ - self::TYPE_NONE, - self::TYPE_LEGITIMATE_INTEREST, - self::TYPE_EXPLICIT_CONSENT_TO_PROCESS, - self::TYPE_IMPLICIT_CONSENT_TO_PROCESS, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getLawfulBasisAllowableValues() - { - return [ - self::LAWFUL_BASIS_CLIENT, - self::LAWFUL_BASIS_LEAD, - self::LAWFUL_BASIS_OTHER, - ]; - } - - /** - * 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', $data ?? [], 'none'); - $this->setIfExists('lawful_basis', $data ?? [], null); - $this->setIfExists('privacy_text', $data ?? [], null); - $this->setIfExists('subscription_type_ids', $data ?? [], null); - $this->setIfExists('communication_consent_text', $data ?? [], null); - $this->setIfExists('communications_checkboxes', $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); - - // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; - } - - /** - * 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'] === 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['lawful_basis'] === null) { - $invalidProperties[] = "'lawful_basis' can't be null"; - } - $allowedValues = $this->getLawfulBasisAllowableValues(); - if (!is_null($this->container['lawful_basis']) && !in_array($this->container['lawful_basis'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'lawful_basis', must be one of '%s'", - $this->container['lawful_basis'], - implode("', '", $allowedValues) - ); - } - - if ($this->container['privacy_text'] === null) { - $invalidProperties[] = "'privacy_text' can't be null"; - } - if ($this->container['subscription_type_ids'] === null) { - $invalidProperties[] = "'subscription_type_ids' can't be null"; - } - if ($this->container['communications_checkboxes'] === null) { - $invalidProperties[] = "'communications_checkboxes' 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 - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type The legal consent type. Set to \"none\" to indicate no legal consent configuration is required for this form. - * - * @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 lawful_basis - * - * @return string - */ - public function getLawfulBasis() - { - return $this->container['lawful_basis']; - } - - /** - * Sets lawful_basis - * - * @param string $lawful_basis The lawful basis for data processing under legitimate interest. Values: lead (processing for lead generation), client (processing for existing clients), other (other legitimate interests). Default: lead. - * - * @return self - */ - public function setLawfulBasis($lawful_basis) - { - if (is_null($lawful_basis)) { - throw new \InvalidArgumentException('non-nullable lawful_basis cannot be null'); - } - $allowedValues = $this->getLawfulBasisAllowableValues(); - if (!in_array($lawful_basis, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'lawful_basis', must be one of '%s'", - $lawful_basis, - implode("', '", $allowedValues) - ) - ); - } - $this->container['lawful_basis'] = $lawful_basis; - - return $this; - } - - /** - * Gets privacy_text - * - * @return string - */ - public function getPrivacyText() - { - return $this->container['privacy_text']; - } - - /** - * Sets privacy_text - * - * @param string $privacy_text Text explaining the privacy policy and data handling practices. - * - * @return self - */ - public function setPrivacyText($privacy_text) - { - if (is_null($privacy_text)) { - throw new \InvalidArgumentException('non-nullable privacy_text cannot be null'); - } - $this->container['privacy_text'] = $privacy_text; - - return $this; - } - - /** - * Gets subscription_type_ids - * - * @return int[] - */ - public function getSubscriptionTypeIds() - { - return $this->container['subscription_type_ids']; - } - - /** - * Sets subscription_type_ids - * - * @param int[] $subscription_type_ids subscription_type_ids - * - * @return self - */ - public function setSubscriptionTypeIds($subscription_type_ids) - { - if (is_null($subscription_type_ids)) { - throw new \InvalidArgumentException('non-nullable subscription_type_ids cannot be null'); - } - $this->container['subscription_type_ids'] = $subscription_type_ids; - - 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 Text explaining communication consent preferences. - * - * @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 - * - * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] - */ - public function getCommunicationsCheckboxes() - { - return $this->container['communications_checkboxes']; - } - - /** - * Sets communications_checkboxes - * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes - * - * @return self - */ - public function setCommunicationsCheckboxes($communications_checkboxes) - { - if (is_null($communications_checkboxes)) { - throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); - } - $this->container['communications_checkboxes'] = $communications_checkboxes; - - return $this; - } - - /** - * Gets consent_to_process_checkbox_label - * - * @return string|null - */ - public function getConsentToProcessCheckboxLabel() - { - return $this->container['consent_to_process_checkbox_label']; - } - - /** - * Sets consent_to_process_checkbox_label - * - * @param string|null $consent_to_process_checkbox_label Label text for the consent to process checkbox. - * - * @return self - */ - public function setConsentToProcessCheckboxLabel($consent_to_process_checkbox_label) - { - if (is_null($consent_to_process_checkbox_label)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_checkbox_label cannot be null'); - } - $this->container['consent_to_process_checkbox_label'] = $consent_to_process_checkbox_label; - - return $this; - } - - /** - * Gets consent_to_process_footer_text - * - * @return string|null - */ - public function getConsentToProcessFooterText() - { - return $this->container['consent_to_process_footer_text']; - } - - /** - * Sets consent_to_process_footer_text - * - * @param string|null $consent_to_process_footer_text Footer text for the consent to process section. - * - * @return self - */ - public function setConsentToProcessFooterText($consent_to_process_footer_text) - { - 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_footer_text'] = $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 Text explaining the consent to process personal data. - * - * @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. - * - * @param integer|string $offset Offset - * - * @return boolean - */ - public function offsetExists(mixed $offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer|string $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet(mixed $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|string $offset Offset - * - * @return void - */ - public function offsetUnset(mixed $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/Transactional/Api/SMTPTokensApi.php b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php index 5fa8298c..e2d9a7da 100644 --- a/codegen/Marketing/Transactional/Api/SMTPTokensApi.php +++ b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php @@ -333,7 +333,7 @@ public function archiveTokenRequest($token_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -597,7 +597,7 @@ public function createTokenRequest($smtp_api_token_request_egg, string $contentT if (isset($smtp_api_token_request_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($smtp_api_token_request_egg), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $smtp_api_token_request_egg; } @@ -618,7 +618,7 @@ public function createTokenRequest($smtp_api_token_request_egg, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -904,7 +904,7 @@ public function getTokenByIdRequest($token_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1230,7 +1230,7 @@ public function getTokensPageRequest($after = null, $campaign_name = null, $emai } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1516,7 +1516,7 @@ public function resetPasswordRequest($token_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php index 36fb66d6..1ba2b7c3 100644 --- a/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php +++ b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php @@ -355,7 +355,7 @@ public function sendEmailRequest($public_single_send_request_egg, string $conten if (isset($public_single_send_request_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_single_send_request_egg), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_single_send_request_egg; } @@ -376,7 +376,7 @@ public function sendEmailRequest($public_single_send_request_egg, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/AccessTokensApi.php b/codegen/Oauth/Api/AccessTokensApi.php index 7aac0e57..6e67c6b8 100644 --- a/codegen/Oauth/Api/AccessTokensApi.php +++ b/codegen/Oauth/Api/AccessTokensApi.php @@ -374,7 +374,7 @@ public function getRequest($token, string $contentType = self::contentTypes['get } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/RefreshTokensApi.php b/codegen/Oauth/Api/RefreshTokensApi.php index fd313cd0..ec914b14 100644 --- a/codegen/Oauth/Api/RefreshTokensApi.php +++ b/codegen/Oauth/Api/RefreshTokensApi.php @@ -321,7 +321,7 @@ public function archiveRequest($token, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -600,7 +600,7 @@ public function getRequest($token, string $contentType = self::contentTypes['get } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/TokensApi.php b/codegen/Oauth/Api/TokensApi.php index 56d4f21b..bbd17e8d 100644 --- a/codegen/Oauth/Api/TokensApi.php +++ b/codegen/Oauth/Api/TokensApi.php @@ -421,7 +421,7 @@ public function createRequest($grant_type = null, $code = null, $redirect_uri = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/BusinessUnits/Api/BasicApi.php b/codegen/Settings/BusinessUnits/Api/BasicApi.php index ac78ab2a..053a6780 100644 --- a/codegen/Settings/BusinessUnits/Api/BasicApi.php +++ b/codegen/Settings/BusinessUnits/Api/BasicApi.php @@ -407,7 +407,7 @@ public function getByUserIDRequest($user_id, $name = null, $properties = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/BusinessUnits/Api/BusinessUnitsApi.php b/codegen/Settings/BusinessUnits/Api/BusinessUnitsApi.php deleted file mode 100644 index 2c44f820..00000000 --- a/codegen/Settings/BusinessUnits/Api/BusinessUnitsApi.php +++ /dev/null @@ -1,513 +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, - 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 getByUserID - * - * Get Business Units for a user - * - * @param string $user_id (required) - * @param string[]|null $properties (optional) - * @param string[]|null $name (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 - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging|\HubSpot\Client\Settings\BusinessUnits\Model\Error - */ - public function getByUserID($user_id, $properties = null, $name = null, string $contentType = self::contentTypes['getByUserID'][0]) - { - list($response) = $this->getByUserIDWithHttpInfo($user_id, $properties, $name, $contentType); - return $response; - } - - /** - * Operation getByUserIDWithHttpInfo - * - * Get Business Units for a user - * - * @param string $user_id (required) - * @param string[]|null $properties (optional) - * @param string[]|null $name (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 - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging|\HubSpot\Client\Settings\BusinessUnits\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByUserIDWithHttpInfo($user_id, $properties = null, $name = null, string $contentType = self::contentTypes['getByUserID'][0]) - { - $request = $this->getByUserIDRequest($user_id, $properties, $name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Settings\BusinessUnits\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Settings\BusinessUnits\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByUserIDAsync - * - * Get Business Units for a user - * - * @param string $user_id (required) - * @param string[]|null $properties (optional) - * @param string[]|null $name (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByUserIDAsync($user_id, $properties = null, $name = null, string $contentType = self::contentTypes['getByUserID'][0]) - { - return $this->getByUserIDAsyncWithHttpInfo($user_id, $properties, $name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByUserIDAsyncWithHttpInfo - * - * Get Business Units for a user - * - * @param string $user_id (required) - * @param string[]|null $properties (optional) - * @param string[]|null $name (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 - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByUserIDAsyncWithHttpInfo($user_id, $properties = null, $name = null, string $contentType = self::contentTypes['getByUserID'][0]) - { - $returnType = '\HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging'; - $request = $this->getByUserIDRequest($user_id, $properties, $name, $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 'getByUserID' - * - * @param string $user_id (required) - * @param string[]|null $properties (optional) - * @param string[]|null $name (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 - * @return \GuzzleHttp\Psr7\Request - */ - public function getByUserIDRequest($user_id, $properties = null, $name = null, string $contentType = self::contentTypes['getByUserID'][0]) - { - - // verify the required parameter 'user_id' is set - if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user_id when calling getByUserID' - ); - } - - - - - $resourcePath = '/business-units/v3/business-units/user/{userId}'; - $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( - $name, - 'name', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($user_id !== null) { - $resourcePath = str_replace( - '{' . 'userId' . '}', - ObjectSerializer::toPathValue($user_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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Settings/Users/Api/BasicApi.php b/codegen/Settings/Users/Api/BasicApi.php index e8589053..719113b9 100644 --- a/codegen/Settings/Users/Api/BasicApi.php +++ b/codegen/Settings/Users/Api/BasicApi.php @@ -382,7 +382,7 @@ public function settingsUsersV3Request($after = null, $limit = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function settingsUsersV3_0Request($user_provision_request, string $conten if (isset($user_provision_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($user_provision_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $user_provision_request; } @@ -659,7 +659,7 @@ public function settingsUsersV3_0Request($user_provision_request, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/RolesApi.php b/codegen/Settings/Users/Api/RolesApi.php index ffec8de7..0725a7e9 100644 --- a/codegen/Settings/Users/Api/RolesApi.php +++ b/codegen/Settings/Users/Api/RolesApi.php @@ -357,7 +357,7 @@ public function getAllRequest(string $contentType = self::contentTypes['getAll'] } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/TeamsApi.php b/codegen/Settings/Users/Api/TeamsApi.php index cdcf51dc..20116b31 100644 --- a/codegen/Settings/Users/Api/TeamsApi.php +++ b/codegen/Settings/Users/Api/TeamsApi.php @@ -357,7 +357,7 @@ public function getAllRequest(string $contentType = self::contentTypes['getAll'] } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/UsersApi.php b/codegen/Settings/Users/Api/UsersApi.php index 53b49de5..e16e1854 100644 --- a/codegen/Settings/Users/Api/UsersApi.php +++ b/codegen/Settings/Users/Api/UsersApi.php @@ -342,7 +342,7 @@ public function archiveRequest($user_id, $id_property = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -643,7 +643,7 @@ public function getByIdRequest($user_id, $id_property = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -942,7 +942,7 @@ public function updateRequest($user_id, $public_user_update, $id_property = null if (isset($public_user_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_user_update), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $public_user_update; } @@ -963,7 +963,7 @@ public function updateRequest($user_id, $public_user_update, $id_property = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Webhooks/Api/BasicApi.php b/codegen/Webhooks/Api/BasicApi.php index e7b426d8..c89ca460 100644 --- a/codegen/Webhooks/Api/BasicApi.php +++ b/codegen/Webhooks/Api/BasicApi.php @@ -362,16 +362,17 @@ public function archiveRequest($app_id, $subscription_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -592,16 +593,17 @@ public function clearRequest($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -876,7 +878,7 @@ public function configureRequest($app_id, $settings_change_request, string $cont if (isset($settings_change_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_change_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $settings_change_request; } @@ -897,16 +899,17 @@ public function configureRequest($app_id, $settings_change_request, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1181,7 +1184,7 @@ public function createRequest($app_id, $subscription_create_request, string $con if (isset($subscription_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($subscription_create_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $subscription_create_request; } @@ -1202,16 +1205,17 @@ public function createRequest($app_id, $subscription_create_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1488,16 +1492,17 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -1774,16 +1779,17 @@ public function getAll_0Request($app_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2080,16 +2086,17 @@ public function getByIdRequest($app_id, $subscription_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -2384,7 +2391,7 @@ public function updateRequest($app_id, $subscription_id, $subscription_patch_req if (isset($subscription_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($subscription_patch_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $subscription_patch_request; } @@ -2405,16 +2412,17 @@ public function updateRequest($app_id, $subscription_id, $subscription_patch_req } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Webhooks/Api/BatchApi.php b/codegen/Webhooks/Api/BatchApi.php index 5ca825a6..5fba659b 100644 --- a/codegen/Webhooks/Api/BatchApi.php +++ b/codegen/Webhooks/Api/BatchApi.php @@ -389,7 +389,7 @@ public function updateBatchRequest($app_id, $batch_input_subscription_batch_upda if (isset($batch_input_subscription_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_subscription_batch_update_request), JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_subscription_batch_update_request; } @@ -410,16 +410,17 @@ public function updateBatchRequest($app_id, $batch_input_subscription_batch_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + $httpBody = json_encode($1, JSON_THROW_ON_ERROR); } 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(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; diff --git a/codegen/Webhooks/Api/SettingsApi.php b/codegen/Webhooks/Api/SettingsApi.php deleted file mode 100644 index 726d1782..00000000 --- a/codegen/Webhooks/Api/SettingsApi.php +++ /dev/null @@ -1,1027 +0,0 @@ - [ - 'application/json', - ], - 'configure' => [ - 'application/json', - ], - 'getAll' => [ - '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 clear - * - * Delete webhook settings - * - * @param int $app_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clear'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function clear($app_id, string $contentType = self::contentTypes['clear'][0]) - { - $this->clearWithHttpInfo($app_id, $contentType); - } - - /** - * Operation clearWithHttpInfo - * - * Delete webhook settings - * - * @param int $app_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clear'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Webhooks\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 clearWithHttpInfo($app_id, string $contentType = self::contentTypes['clear'][0]) - { - $request = $this->clearRequest($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\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation clearAsync - * - * Delete webhook settings - * - * @param int $app_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function clearAsync($app_id, string $contentType = self::contentTypes['clear'][0]) - { - return $this->clearAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation clearAsyncWithHttpInfo - * - * Delete webhook settings - * - * @param int $app_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function clearAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['clear'][0]) - { - $returnType = ''; - $request = $this->clearRequest($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 'clear' - * - * @param int $app_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function clearRequest($app_id, string $contentType = self::contentTypes['clear'][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 clear' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/settings'; - $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 configure - * - * Update webhook settings - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request settings_change_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['configure'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SettingsResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function configure($app_id, $settings_change_request, string $contentType = self::contentTypes['configure'][0]) - { - list($response) = $this->configureWithHttpInfo($app_id, $settings_change_request, $contentType); - return $response; - } - - /** - * Operation configureWithHttpInfo - * - * Update webhook settings - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['configure'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SettingsResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function configureWithHttpInfo($app_id, $settings_change_request, string $contentType = self::contentTypes['configure'][0]) - { - $request = $this->configureRequest($app_id, $settings_change_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation configureAsync - * - * Update webhook settings - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['configure'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function configureAsync($app_id, $settings_change_request, string $contentType = self::contentTypes['configure'][0]) - { - return $this->configureAsyncWithHttpInfo($app_id, $settings_change_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation configureAsyncWithHttpInfo - * - * Update webhook settings - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['configure'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function configureAsyncWithHttpInfo($app_id, $settings_change_request, string $contentType = self::contentTypes['configure'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse'; - $request = $this->configureRequest($app_id, $settings_change_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 'configure' - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['configure'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function configureRequest($app_id, $settings_change_request, string $contentType = self::contentTypes['configure'][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 configure' - ); - } - - // verify the required parameter 'settings_change_request' is set - if ($settings_change_request === null || (is_array($settings_change_request) && count($settings_change_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $settings_change_request when calling configure' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/settings'; - $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($settings_change_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($settings_change_request)); - } else { - $httpBody = $settings_change_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( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getAll - * - * Read webhook settings - * - * @param int $app_id (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SettingsResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Read webhook settings - * - * @param int $app_id (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SettingsResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Read webhook settings - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Read webhook settings - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse'; - $request = $this->getAllRequest($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 'getAll' - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][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 getAll' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/settings'; - $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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} diff --git a/codegen/Webhooks/Api/SubscriptionsApi.php b/codegen/Webhooks/Api/SubscriptionsApi.php deleted file mode 100644 index f5584c9f..00000000 --- a/codegen/Webhooks/Api/SubscriptionsApi.php +++ /dev/null @@ -1,2009 +0,0 @@ - [ - 'application/json', - ], - 'create' => [ - 'application/json', - ], - 'getAll' => [ - 'application/json', - ], - 'getById' => [ - 'application/json', - ], - 'update' => [ - 'application/json', - ], - 'updateBatch' => [ - '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 event subscription - * - * @param int $subscription_id (required) - * @param int $app_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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function archive($subscription_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $this->archiveWithHttpInfo($subscription_id, $app_id, $contentType); - } - - /** - * Operation archiveWithHttpInfo - * - * Delete event subscription - * - * @param int $subscription_id (required) - * @param int $app_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\Webhooks\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($subscription_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($subscription_id, $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\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete event subscription - * - * @param int $subscription_id (required) - * @param int $app_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($subscription_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($subscription_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete event subscription - * - * @param int $subscription_id (required) - * @param int $app_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($subscription_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = ''; - $request = $this->archiveRequest($subscription_id, $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 $subscription_id (required) - * @param int $app_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($subscription_id, $app_id, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling archive' - ); - } - - // 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 = '/webhooks/v3/{appId}/subscriptions/{subscriptionId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($subscription_id !== null) { - $resourcePath = str_replace( - '{' . 'subscriptionId' . '}', - ObjectSerializer::toPathValue($subscription_id), - $resourcePath - ); - } - // 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 - * - * Create an event subscription - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionCreateRequest $subscription_create_request subscription_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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function create($app_id, $subscription_create_request, string $contentType = self::contentTypes['create'][0]) - { - list($response) = $this->createWithHttpInfo($app_id, $subscription_create_request, $contentType); - return $response; - } - - /** - * Operation createWithHttpInfo - * - * Create an event subscription - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionCreateRequest $subscription_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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function createWithHttpInfo($app_id, $subscription_create_request, string $contentType = self::contentTypes['create'][0]) - { - $request = $this->createRequest($app_id, $subscription_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation createAsync - * - * Create an event subscription - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionCreateRequest $subscription_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 createAsync($app_id, $subscription_create_request, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($app_id, $subscription_create_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create an event subscription - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionCreateRequest $subscription_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 createAsyncWithHttpInfo($app_id, $subscription_create_request, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; - $request = $this->createRequest($app_id, $subscription_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 'create' - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionCreateRequest $subscription_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 createRequest($app_id, $subscription_create_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 'subscription_create_request' is set - if ($subscription_create_request === null || (is_array($subscription_create_request) && count($subscription_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_create_request when calling create' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/subscriptions'; - $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($subscription_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($subscription_create_request)); - } else { - $httpBody = $subscription_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 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 getAll - * - * Read event subscriptions - * - * @param int $app_id (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SubscriptionListResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - list($response) = $this->getAllWithHttpInfo($app_id, $contentType); - return $response; - } - - /** - * Operation getAllWithHttpInfo - * - * Read event subscriptions - * - * @param int $app_id (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SubscriptionListResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $request = $this->getAllRequest($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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionListResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionListResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SubscriptionListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getAllAsync - * - * Read event subscriptions - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - return $this->getAllAsyncWithHttpInfo($app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAllAsyncWithHttpInfo - * - * Read event subscriptions - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionListResponse'; - $request = $this->getAllRequest($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 'getAll' - * - * @param int $app_id (required) - * @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($app_id, string $contentType = self::contentTypes['getAll'][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 getAll' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/subscriptions'; - $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 getById - * - * Read an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function getById($subscription_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($subscription_id, $app_id, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Read an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($subscription_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($subscription_id, $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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Read an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (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($subscription_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($subscription_id, $app_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Read an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (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($subscription_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; - $request = $this->getByIdRequest($subscription_id, $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 $subscription_id (required) - * @param int $app_id (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($subscription_id, $app_id, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling getById' - ); - } - - // 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 = '/webhooks/v3/{appId}/subscriptions/{subscriptionId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($subscription_id !== null) { - $resourcePath = str_replace( - '{' . 'subscriptionId' . '}', - ObjectSerializer::toPathValue($subscription_id), - $resourcePath - ); - } - // 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 an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionPatchRequest $subscription_patch_request subscription_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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error - */ - public function update($subscription_id, $app_id, $subscription_patch_request, string $contentType = self::contentTypes['update'][0]) - { - list($response) = $this->updateWithHttpInfo($subscription_id, $app_id, $subscription_patch_request, $contentType); - return $response; - } - - /** - * Operation updateWithHttpInfo - * - * Update an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionPatchRequest $subscription_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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\SubscriptionResponse|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($subscription_id, $app_id, $subscription_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $request = $this->updateRequest($subscription_id, $app_id, $subscription_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\SubscriptionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateAsync - * - * Update an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionPatchRequest $subscription_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($subscription_id, $app_id, $subscription_patch_request, string $contentType = self::contentTypes['update'][0]) - { - return $this->updateAsyncWithHttpInfo($subscription_id, $app_id, $subscription_patch_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateAsyncWithHttpInfo - * - * Update an event subscription - * - * @param int $subscription_id (required) - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionPatchRequest $subscription_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($subscription_id, $app_id, $subscription_patch_request, string $contentType = self::contentTypes['update'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; - $request = $this->updateRequest($subscription_id, $app_id, $subscription_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 $subscription_id (required) - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\SubscriptionPatchRequest $subscription_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($subscription_id, $app_id, $subscription_patch_request, string $contentType = self::contentTypes['update'][0]) - { - - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling update' - ); - } - - // 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 'subscription_patch_request' is set - if ($subscription_patch_request === null || (is_array($subscription_patch_request) && count($subscription_patch_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_patch_request when calling update' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/subscriptions/{subscriptionId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($subscription_id !== null) { - $resourcePath = str_replace( - '{' . 'subscriptionId' . '}', - ObjectSerializer::toPathValue($subscription_id), - $resourcePath - ); - } - // 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($subscription_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($subscription_patch_request)); - } else { - $httpBody = $subscription_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 - ); - } - - /** - * Operation updateBatch - * - * Batch create event subscriptions - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\BatchInputSubscriptionBatchUpdateRequest $batch_input_subscription_batch_update_request batch_input_subscription_batch_update_request (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse|\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponseWithErrors|\HubSpot\Client\Webhooks\Model\Error - */ - public function updateBatch($app_id, $batch_input_subscription_batch_update_request, string $contentType = self::contentTypes['updateBatch'][0]) - { - list($response) = $this->updateBatchWithHttpInfo($app_id, $batch_input_subscription_batch_update_request, $contentType); - return $response; - } - - /** - * Operation updateBatchWithHttpInfo - * - * Batch create event subscriptions - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\BatchInputSubscriptionBatchUpdateRequest $batch_input_subscription_batch_update_request (required) - * @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\Webhooks\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse|\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponseWithErrors|\HubSpot\Client\Webhooks\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function updateBatchWithHttpInfo($app_id, $batch_input_subscription_batch_update_request, string $contentType = self::contentTypes['updateBatch'][0]) - { - $request = $this->updateBatchRequest($app_id, $batch_input_subscription_batch_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: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse', - $request, - $response, - ); - case 207: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponseWithErrors', - $request, - $response, - ); - default: - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\Error', - $request, - $response, - ); - } - - - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return $this->handleResponseWithDataType( - '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse', - $request, - $response, - ); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponseWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Webhooks\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - throw $e; - } - - - throw $e; - } - } - - /** - * Operation updateBatchAsync - * - * Batch create event subscriptions - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\BatchInputSubscriptionBatchUpdateRequest $batch_input_subscription_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsync($app_id, $batch_input_subscription_batch_update_request, string $contentType = self::contentTypes['updateBatch'][0]) - { - return $this->updateBatchAsyncWithHttpInfo($app_id, $batch_input_subscription_batch_update_request, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateBatchAsyncWithHttpInfo - * - * Batch create event subscriptions - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\BatchInputSubscriptionBatchUpdateRequest $batch_input_subscription_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateBatchAsyncWithHttpInfo($app_id, $batch_input_subscription_batch_update_request, string $contentType = self::contentTypes['updateBatch'][0]) - { - $returnType = '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse'; - $request = $this->updateBatchRequest($app_id, $batch_input_subscription_batch_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 'updateBatch' - * - * @param int $app_id (required) - * @param \HubSpot\Client\Webhooks\Model\BatchInputSubscriptionBatchUpdateRequest $batch_input_subscription_batch_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function updateBatchRequest($app_id, $batch_input_subscription_batch_update_request, string $contentType = self::contentTypes['updateBatch'][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 updateBatch' - ); - } - - // verify the required parameter 'batch_input_subscription_batch_update_request' is set - if ($batch_input_subscription_batch_update_request === null || (is_array($batch_input_subscription_batch_update_request) && count($batch_input_subscription_batch_update_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_subscription_batch_update_request when calling updateBatch' - ); - } - - - $resourcePath = '/webhooks/v3/{appId}/subscriptions/batch/update'; - $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($batch_input_subscription_batch_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_subscription_batch_update_request)); - } else { - $httpBody = $batch_input_subscription_batch_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 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 - ); - } - - /** - * 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()); - } - } - - if ($this->config->getCertFile()) { - $options[RequestOptions::CERT] = $this->config->getCertFile(); - } - - if ($this->config->getKeyFile()) { - $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); - } - - return $options; - } - - private function handleResponseWithDataType( - string $dataType, - RequestInterface $request, - ResponseInterface $response - ): array { - if ($dataType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($dataType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $response->getStatusCode(), - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $dataType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - private function responseWithinRangeCode( - string $rangeCode, - int $statusCode - ): bool { - $left = (int) ($rangeCode[0].'00'); - $right = (int) ($rangeCode[0].'99'); - - return $statusCode >= $left && $statusCode <= $right; - } -} From 49e6b48e136bae5395832c4f3ffe01576b8554d6 Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Tue, 22 Sep 2026 14:31:58 -0400 Subject: [PATCH 2/5] Fix Guzzle 8 replacements: restore capture group expansion in replaceInFiles The July 2026 "lazy function replacements" change wrapped string replacements in () => replacement, which prevents JavaScript's $1 capture group expansion. This caused json_encode($1, ...) to appear literally in generated PHP, breaking all clients. Pass string replacements directly to String.replace() so $1 expands. Co-Authored-By: Claude Sonnet 4.6 --- .../Automation/Actions/Api/CallbacksApi.php | 8 +- .../Automation/Actions/Api/DefinitionsApi.php | 20 ++--- .../Automation/Actions/Api/FunctionsApi.php | 18 ++--- .../Automation/Actions/Api/RevisionsApi.php | 4 +- codegen/Cms/AuditLogs/Api/BasicApi.php | 2 +- codegen/Cms/Blogs/Authors/Api/BasicApi.php | 14 ++-- codegen/Cms/Blogs/Authors/Api/BatchApi.php | 16 ++-- .../Blogs/Authors/Api/MultiLanguageApi.php | 20 ++--- codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php | 32 ++++---- codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php | 16 ++-- .../Blogs/BlogPosts/Api/MultiLanguageApi.php | 20 ++--- .../Cms/Blogs/BlogPosts/Api/RevisionsApi.php | 8 +- codegen/Cms/Blogs/Tags/Api/BasicApi.php | 14 ++-- codegen/Cms/Blogs/Tags/Api/BatchApi.php | 16 ++-- .../Cms/Blogs/Tags/Api/MultiLanguageApi.php | 20 ++--- codegen/Cms/Domains/Api/BasicApi.php | 4 +- codegen/Cms/Hubdb/Api/RowsApi.php | 50 ++++++------- codegen/Cms/Hubdb/Api/TablesApi.php | 38 +++++----- codegen/Cms/Pages/Api/ABTestsApi.php | 24 +++--- codegen/Cms/Pages/Api/AdvancedApi.php | 10 +-- codegen/Cms/Pages/Api/BasicApi.php | 20 ++--- codegen/Cms/Pages/Api/BatchApi.php | 44 +++++------ codegen/Cms/Pages/Api/FoldersApi.php | 24 +++--- codegen/Cms/Pages/Api/LandingPagesApi.php | 32 ++++---- codegen/Cms/Pages/Api/MultiLanguageApi.php | 36 ++++----- codegen/Cms/Pages/Api/WebsitePagesApi.php | 34 ++++----- codegen/Cms/SiteSearch/Api/BasicApi.php | 2 +- codegen/Cms/SourceCode/Api/AdvancedApi.php | 12 +-- codegen/Cms/SourceCode/Api/BasicApi.php | 6 +- codegen/Cms/UrlRedirects/Api/BasicApi.php | 14 ++-- .../Api/AdvancedApi.php | 8 +- .../CommunicationPreferences/Api/BasicApi.php | 4 +- .../VisitorIdentification/Api/BasicApi.php | 4 +- codegen/Crm/Associations/Api/BatchApi.php | 12 +-- .../Crm/Associations/Schema/Api/BasicApi.php | 2 +- codegen/Crm/Associations/V4/Api/BasicApi.php | 10 +-- codegen/Crm/Associations/V4/Api/BatchApi.php | 20 ++--- codegen/Crm/Associations/V4/Api/ReportApi.php | 2 +- .../Associations/V4/Schema/Api/LabelsApi.php | 12 +-- .../Associations/V4/Schema/Api/LimitsApi.php | 16 ++-- .../Crm/Commerce/Invoices/Api/BasicApi.php | 14 ++-- .../Crm/Commerce/Invoices/Api/BatchApi.php | 20 ++--- .../Crm/Commerce/Invoices/Api/SearchApi.php | 4 +- codegen/Crm/Companies/Api/AdvancedApi.php | 4 +- codegen/Crm/Companies/Api/BasicApi.php | 14 ++-- codegen/Crm/Companies/Api/BatchApi.php | 20 ++--- codegen/Crm/Companies/Api/SearchApi.php | 4 +- codegen/Crm/Contacts/Api/AdvancedApi.php | 8 +- codegen/Crm/Contacts/Api/BasicApi.php | 14 ++-- codegen/Crm/Contacts/Api/BatchApi.php | 20 ++--- codegen/Crm/Contacts/Api/SearchApi.php | 4 +- codegen/Crm/Deals/Api/BasicApi.php | 18 ++--- codegen/Crm/Deals/Api/BatchApi.php | 20 ++--- codegen/Crm/Deals/Api/SearchApi.php | 4 +- codegen/Crm/Exports/Api/AdvancedApi.php | 6 +- codegen/Crm/Exports/Api/BasicApi.php | 2 +- .../Extensions/Calling/Api/AdvancedApi.php | 8 +- .../Crm/Extensions/Calling/Api/BasicApi.php | 38 +++++----- .../Crm/Extensions/Calling/Api/BatchApi.php | 4 +- .../Crm/Extensions/Cards/Api/AdvancedApi.php | 4 +- codegen/Crm/Extensions/Cards/Api/BasicApi.php | 16 ++-- .../Videoconferencing/Api/BasicApi.php | 8 +- codegen/Crm/Imports/Api/AdvancedApi.php | 4 +- codegen/Crm/Imports/Api/BasicApi.php | 6 +- codegen/Crm/LineItems/Api/BasicApi.php | 14 ++-- codegen/Crm/LineItems/Api/BatchApi.php | 20 ++--- codegen/Crm/LineItems/Api/SearchApi.php | 4 +- codegen/Crm/Lists/Api/BasicApi.php | 74 +++++++++---------- codegen/Crm/Lists/Api/BatchApi.php | 4 +- codegen/Crm/Lists/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Api/AdvancedApi.php | 4 +- codegen/Crm/Objects/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Calls/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Calls/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Calls/Api/SearchApi.php | 4 +- .../Objects/Communications/Api/BasicApi.php | 14 ++-- .../Objects/Communications/Api/BatchApi.php | 20 ++--- .../Objects/Communications/Api/SearchApi.php | 4 +- .../Crm/Objects/DealSplits/Api/BatchApi.php | 8 +- codegen/Crm/Objects/Emails/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Emails/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Emails/Api/SearchApi.php | 4 +- .../FeedbackSubmissions/Api/BasicApi.php | 4 +- .../FeedbackSubmissions/Api/BatchApi.php | 4 +- .../FeedbackSubmissions/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Goals/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Goals/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Goals/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Leads/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Leads/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Leads/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Meetings/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Meetings/Api/BatchApi.php | 20 ++--- .../Crm/Objects/Meetings/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Notes/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Notes/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Notes/Api/SearchApi.php | 4 +- .../Crm/Objects/PostalMail/Api/BasicApi.php | 14 ++-- .../Crm/Objects/PostalMail/Api/BatchApi.php | 20 ++--- .../Crm/Objects/PostalMail/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Tasks/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Tasks/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Tasks/Api/SearchApi.php | 4 +- codegen/Crm/Objects/Taxes/Api/BasicApi.php | 14 ++-- codegen/Crm/Objects/Taxes/Api/BatchApi.php | 20 ++--- codegen/Crm/Objects/Taxes/Api/SearchApi.php | 4 +- codegen/Crm/Owners/Api/BasicApi.php | 4 +- codegen/Crm/Pipelines/Api/BasicApi.php | 40 +++++----- codegen/Crm/Products/Api/BasicApi.php | 14 ++-- codegen/Crm/Products/Api/BatchApi.php | 20 ++--- codegen/Crm/Products/Api/SearchApi.php | 4 +- codegen/Crm/Properties/Api/BasicApi.php | 14 ++-- codegen/Crm/Properties/Api/BatchApi.php | 12 +-- codegen/Crm/Properties/Api/CoreApi.php | 14 ++-- codegen/Crm/Quotes/Api/BasicApi.php | 14 ++-- codegen/Crm/Quotes/Api/BatchApi.php | 20 ++--- codegen/Crm/Quotes/Api/SearchApi.php | 4 +- codegen/Crm/Schemas/Api/AdvancedApi.php | 4 +- codegen/Crm/Schemas/Api/BasicApi.php | 16 ++-- codegen/Crm/Schemas/Api/BatchApi.php | 4 +- codegen/Crm/Tickets/Api/AdvancedApi.php | 4 +- codegen/Crm/Tickets/Api/BasicApi.php | 14 ++-- codegen/Crm/Tickets/Api/BatchApi.php | 20 ++--- codegen/Crm/Tickets/Api/SearchApi.php | 4 +- codegen/Crm/Timeline/Api/AdvancedApi.php | 8 +- codegen/Crm/Timeline/Api/BasicApi.php | 22 +++--- codegen/Crm/Timeline/Api/BatchApi.php | 4 +- codegen/Events/Api/BasicApi.php | 4 +- codegen/Events/Send/Api/BasicApi.php | 4 +- codegen/Events/Send/Api/BatchApi.php | 4 +- codegen/Files/Api/BasicApi.php | 2 +- codegen/Files/Api/FilesApi.php | 30 ++++---- codegen/Files/Api/FoldersApi.php | 20 ++--- codegen/Marketing/Emails/Api/BasicApi.php | 10 +-- codegen/Marketing/Emails/Api/EmailsApi.php | 38 +++++----- codegen/Marketing/Events/Api/BasicApi.php | 26 +++---- codegen/Marketing/Events/Api/BatchApi.php | 16 ++-- .../Events/Api/EventAttendeesApi.php | 16 ++-- .../Marketing/Events/Api/EventStatusApi.php | 6 +- .../Marketing/Events/Api/IdentifiersApi.php | 4 +- .../Events/Api/ListAssociationsApi.php | 12 +-- .../Events/Api/ParticipantStateApi.php | 10 +-- codegen/Marketing/Events/Api/SettingsApi.php | 6 +- .../Events/Api/SubscriberStateChangesApi.php | 8 +- codegen/Marketing/Forms/Api/BasicApi.php | 18 ++--- .../Transactional/Api/SMTPTokensApi.php | 12 +-- .../Api/SendTransactionalEmailApi.php | 4 +- codegen/Oauth/Api/AccessTokensApi.php | 2 +- codegen/Oauth/Api/RefreshTokensApi.php | 4 +- codegen/Oauth/Api/TokensApi.php | 2 +- .../Settings/BusinessUnits/Api/BasicApi.php | 2 +- codegen/Settings/Users/Api/BasicApi.php | 6 +- codegen/Settings/Users/Api/RolesApi.php | 2 +- codegen/Settings/Users/Api/TeamsApi.php | 2 +- codegen/Settings/Users/Api/UsersApi.php | 8 +- codegen/Webhooks/Api/BasicApi.php | 22 +++--- codegen/Webhooks/Api/BatchApi.php | 4 +- 159 files changed, 1029 insertions(+), 1029 deletions(-) diff --git a/codegen/Automation/Actions/Api/CallbacksApi.php b/codegen/Automation/Actions/Api/CallbacksApi.php index 9f569ce1..c1befa68 100644 --- a/codegen/Automation/Actions/Api/CallbacksApi.php +++ b/codegen/Automation/Actions/Api/CallbacksApi.php @@ -322,7 +322,7 @@ public function completeRequest($callback_id, $callback_completion_request, stri if (isset($callback_completion_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($callback_completion_request), JSON_THROW_ON_ERROR); } else { $httpBody = $callback_completion_request; } @@ -343,7 +343,7 @@ public function completeRequest($callback_id, $callback_completion_request, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -551,7 +551,7 @@ public function completeBatchRequest($batch_input_callback_completion_batch_requ if (isset($batch_input_callback_completion_batch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_callback_completion_batch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_callback_completion_batch_request; } @@ -572,7 +572,7 @@ public function completeBatchRequest($batch_input_callback_completion_batch_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Automation/Actions/Api/DefinitionsApi.php b/codegen/Automation/Actions/Api/DefinitionsApi.php index c033b3fe..59d61423 100644 --- a/codegen/Automation/Actions/Api/DefinitionsApi.php +++ b/codegen/Automation/Actions/Api/DefinitionsApi.php @@ -359,7 +359,7 @@ public function archiveRequest($app_id, $definition_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -666,7 +666,7 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObjectRequest($app_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObject_0Request($app if (isset($public_action_definition_requires_object_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_requires_object_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_requires_object_request; } @@ -936,7 +936,7 @@ public function automationV4ActionsAppIdDefinitionIdRequiresObject_0Request($app } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1221,7 +1221,7 @@ public function createRequest($app_id, $public_action_definition_egg, string $co if (isset($public_action_definition_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_egg), JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_egg; } @@ -1242,7 +1242,7 @@ public function createRequest($app_id, $public_action_definition_egg, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1564,7 +1564,7 @@ public function getByIdRequest($app_id, $definition_id, $archived = false, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1896,7 +1896,7 @@ public function getPageRequest($app_id, $after = null, $archived = false, $limit } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2201,7 +2201,7 @@ public function updateRequest($app_id, $definition_id, $public_action_definition if (isset($public_action_definition_patch)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_action_definition_patch), JSON_THROW_ON_ERROR); } else { $httpBody = $public_action_definition_patch; } @@ -2222,7 +2222,7 @@ public function updateRequest($app_id, $definition_id, $public_action_definition } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Automation/Actions/Api/FunctionsApi.php b/codegen/Automation/Actions/Api/FunctionsApi.php index 683d7547..686845ec 100644 --- a/codegen/Automation/Actions/Api/FunctionsApi.php +++ b/codegen/Automation/Actions/Api/FunctionsApi.php @@ -399,7 +399,7 @@ public function archiveRequest($app_id, $definition_id, $function_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,7 +670,7 @@ public function archiveByFunctionTypeRequest($app_id, $definition_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1015,7 +1015,7 @@ public function createOrReplaceRequest($app_id, $definition_id, $function_id, $f if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1036,7 +1036,7 @@ public function createOrReplaceRequest($app_id, $definition_id, $function_id, $f } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1361,7 +1361,7 @@ public function createOrReplaceByFunctionTypeRequest($app_id, $definition_id, $f if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1382,7 +1382,7 @@ public function createOrReplaceByFunctionTypeRequest($app_id, $definition_id, $f } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1709,7 +1709,7 @@ public function getByFunctionTypeRequest($app_id, $definition_id, $function_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2056,7 +2056,7 @@ public function getByIdRequest($app_id, $definition_id, $function_id, $function_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2363,7 +2363,7 @@ public function getPageRequest($app_id, $definition_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Automation/Actions/Api/RevisionsApi.php b/codegen/Automation/Actions/Api/RevisionsApi.php index b800be96..d46553c5 100644 --- a/codegen/Automation/Actions/Api/RevisionsApi.php +++ b/codegen/Automation/Actions/Api/RevisionsApi.php @@ -420,7 +420,7 @@ public function getByIdRequest($app_id, $definition_id, $revision_id, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -757,7 +757,7 @@ public function getPageRequest($app_id, $definition_id, $after = null, $limit = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/AuditLogs/Api/BasicApi.php b/codegen/Cms/AuditLogs/Api/BasicApi.php index 32d21d63..a9f16f7a 100644 --- a/codegen/Cms/AuditLogs/Api/BasicApi.php +++ b/codegen/Cms/AuditLogs/Api/BasicApi.php @@ -469,7 +469,7 @@ public function cmsAuditLogsV3Request($after = null, $before = null, $event_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/BasicApi.php b/codegen/Cms/Blogs/Authors/Api/BasicApi.php index f25ebf6b..ec470305 100644 --- a/codegen/Cms/Blogs/Authors/Api/BasicApi.php +++ b/codegen/Cms/Blogs/Authors/Api/BasicApi.php @@ -348,7 +348,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -612,7 +612,7 @@ public function createRequest($blog_author, string $contentType = self::contentT if (isset($blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author; } @@ -633,7 +633,7 @@ public function createRequest($blog_author, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -949,7 +949,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1380,7 +1380,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1679,7 +1679,7 @@ public function updateRequest($object_id, $blog_author, $archived = null, string if (isset($blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author; } @@ -1700,7 +1700,7 @@ public function updateRequest($object_id, $blog_author, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/BatchApi.php b/codegen/Cms/Blogs/Authors/Api/BatchApi.php index e4fe6713..99a1fb32 100644 --- a/codegen/Cms/Blogs/Authors/Api/BatchApi.php +++ b/codegen/Cms/Blogs/Authors/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createBatchRequest($batch_input_blog_author, string $contentType if (isset($batch_input_blog_author)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_author), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_blog_author; } @@ -628,7 +628,7 @@ public function createBatchRequest($batch_input_blog_author, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php index 415731f1..633cb0f0 100644 --- a/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/Authors/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($blog_author_clone_request_v_next, st if (isset($blog_author_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_author_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_author_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($blog_author_clone_request_v_next, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php index 162163d9..55213d8b 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -936,7 +936,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2429,7 +2429,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2658,7 +2658,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2957,7 +2957,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -2978,7 +2978,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3262,7 +3262,7 @@ public function updateDraftRequest($object_id, $blog_post, string $contentType = if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post; } @@ -3283,7 +3283,7 @@ public function updateDraftRequest($object_id, $blog_post, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php index c5892eb0..86dc2841 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveRequest($batch_input_string, string $contentType = self:: if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveRequest($batch_input_string, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createRequest($batch_input_blog_post, string $contentType = self 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_post), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_blog_post; } @@ -628,7 +628,7 @@ public function createRequest($batch_input_blog_post, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readRequest($batch_input_string, $archived = null, string $conte if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readRequest($batch_input_string, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateRequest($batch_input_json_node, $archived = null, string $ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateRequest($batch_input_json_node, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php index 73f52eb1..e4dc1e6f 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($blog_post_language_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $blog_post_language_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php b/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php index cc3d79b6..ea180b76 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/RevisionsApi.php @@ -406,7 +406,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -737,7 +737,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1043,7 +1043,7 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1349,7 +1349,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Tags/Api/BasicApi.php b/codegen/Cms/Blogs/Tags/Api/BasicApi.php index c014011a..7e13ee1e 100644 --- a/codegen/Cms/Blogs/Tags/Api/BasicApi.php +++ b/codegen/Cms/Blogs/Tags/Api/BasicApi.php @@ -348,7 +348,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -612,7 +612,7 @@ public function createRequest($tag, string $contentType = self::contentTypes['cr if (isset($tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag), JSON_THROW_ON_ERROR); } else { $httpBody = $tag; } @@ -633,7 +633,7 @@ public function createRequest($tag, string $contentType = self::contentTypes['cr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -949,7 +949,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1380,7 +1380,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1679,7 +1679,7 @@ public function updateRequest($object_id, $tag, $archived = null, string $conten if (isset($tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag), JSON_THROW_ON_ERROR); } else { $httpBody = $tag; } @@ -1700,7 +1700,7 @@ public function updateRequest($object_id, $tag, $archived = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Tags/Api/BatchApi.php b/codegen/Cms/Blogs/Tags/Api/BatchApi.php index 2131f517..baec9de6 100644 --- a/codegen/Cms/Blogs/Tags/Api/BatchApi.php +++ b/codegen/Cms/Blogs/Tags/Api/BatchApi.php @@ -308,7 +308,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -607,7 +607,7 @@ public function createBatchRequest($batch_input_tag, string $contentType = self: if (isset($batch_input_tag)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_tag), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_tag; } @@ -628,7 +628,7 @@ public function createBatchRequest($batch_input_tag, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -942,7 +942,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1235,7 +1235,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -1256,7 +1256,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php index eace0931..4791f64a 100644 --- a/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php +++ b/codegen/Cms/Blogs/Tags/Api/MultiLanguageApi.php @@ -353,7 +353,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -374,7 +374,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function createLangVariationRequest($tag_clone_request_v_next, string $co if (isset($tag_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($tag_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $tag_clone_request_v_next; } @@ -659,7 +659,7 @@ public function createLangVariationRequest($tag_clone_request_v_next, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -909,7 +909,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -930,7 +930,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1138,7 +1138,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1159,7 +1159,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -1430,7 +1430,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Domains/Api/BasicApi.php b/codegen/Cms/Domains/Api/BasicApi.php index b31ab253..e3cd5f90 100644 --- a/codegen/Cms/Domains/Api/BasicApi.php +++ b/codegen/Cms/Domains/Api/BasicApi.php @@ -502,7 +502,7 @@ public function cmsV3DomainsRequest($after = null, $archived = null, $created_af } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -788,7 +788,7 @@ public function getByIdRequest($domain_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Hubdb/Api/RowsApi.php b/codegen/Cms/Hubdb/Api/RowsApi.php index 069a184a..133f1b13 100644 --- a/codegen/Cms/Hubdb/Api/RowsApi.php +++ b/codegen/Cms/Hubdb/Api/RowsApi.php @@ -457,7 +457,7 @@ public function cloneDraftTableRowRequest($row_id, $table_id_or_name, $name = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -741,7 +741,7 @@ public function cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_d if (isset($batch_input_hub_db_table_row_batch_clone_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_batch_clone_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_batch_clone_request; } @@ -762,7 +762,7 @@ public function cloneDraftTableRowsRequest($table_id_or_name, $batch_input_hub_d } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1060,7 +1060,7 @@ public function createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ if (isset($batch_input_hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_request; } @@ -1081,7 +1081,7 @@ public function createDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1365,7 +1365,7 @@ public function createTableRowRequest($table_id_or_name, $hub_db_table_row_v3_re if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -1386,7 +1386,7 @@ public function createTableRowRequest($table_id_or_name, $hub_db_table_row_v3_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1710,7 +1710,7 @@ public function getDraftTableRowByIdRequest($row_id, $table_id_or_name, $archive } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2034,7 +2034,7 @@ public function getTableRowRequest($row_id, $table_id_or_name, $archived = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2410,7 +2410,7 @@ public function getTableRowsRequest($table_id_or_name, $after = null, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2663,7 +2663,7 @@ public function purgeDraftTableRowRequest($row_id, $table_id_or_name, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2891,7 +2891,7 @@ public function purgeDraftTableRowsRequest($table_id_or_name, $batch_input_strin if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2912,7 +2912,7 @@ public function purgeDraftTableRowsRequest($table_id_or_name, $batch_input_strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3210,7 +3210,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $batch_input_string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -3231,7 +3231,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $batch_input_string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3529,7 +3529,7 @@ public function readTableRowsRequest($table_id_or_name, $batch_input_string, str if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -3550,7 +3550,7 @@ public function readTableRowsRequest($table_id_or_name, $batch_input_string, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3857,7 +3857,7 @@ public function replaceDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_ if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -3878,7 +3878,7 @@ public function replaceDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4176,7 +4176,7 @@ public function replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub if (isset($batch_input_hub_db_table_row_v3_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_batch_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_batch_update_request; } @@ -4197,7 +4197,7 @@ public function replaceDraftTableRowsRequest($table_id_or_name, $batch_input_hub } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4504,7 +4504,7 @@ public function updateDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_t if (isset($hub_db_table_row_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_row_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_row_v3_request; } @@ -4525,7 +4525,7 @@ public function updateDraftTableRowRequest($row_id, $table_id_or_name, $hub_db_t } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4823,7 +4823,7 @@ public function updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ if (isset($batch_input_hub_db_table_row_v3_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_hub_db_table_row_v3_batch_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_hub_db_table_row_v3_batch_update_request; } @@ -4844,7 +4844,7 @@ public function updateDraftTableRowsRequest($table_id_or_name, $batch_input_hub_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Hubdb/Api/TablesApi.php b/codegen/Cms/Hubdb/Api/TablesApi.php index f61e7f66..c079c632 100644 --- a/codegen/Cms/Hubdb/Api/TablesApi.php +++ b/codegen/Cms/Hubdb/Api/TablesApi.php @@ -366,7 +366,7 @@ public function archiveTableRequest($table_id_or_name, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -650,7 +650,7 @@ public function cloneDraftTableRequest($table_id_or_name, $hub_db_table_clone_re if (isset($hub_db_table_clone_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_clone_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_clone_request; } @@ -671,7 +671,7 @@ public function cloneDraftTableRequest($table_id_or_name, $hub_db_table_clone_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -935,7 +935,7 @@ public function createTableRequest($hub_db_table_v3_request, string $contentType if (isset($hub_db_table_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_v3_request; } @@ -956,7 +956,7 @@ public function createTableRequest($hub_db_table_v3_request, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1257,7 +1257,7 @@ public function exportDraftTableRequest($table_id_or_name, $format = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1558,7 +1558,7 @@ public function exportTableRequest($table_id_or_name, $format = null, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2004,7 +2004,7 @@ public function getAllDraftTablesRequest($after = null, $archived = null, $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2450,7 +2450,7 @@ public function getAllTablesRequest($after = null, $archived = null, $content_ty } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2781,7 +2781,7 @@ public function getDraftTableDetailsByIdRequest($table_id_or_name, $archived = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3112,7 +3112,7 @@ public function getTableDetailsRequest($table_id_or_name, $archived = null, $inc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3421,7 +3421,7 @@ public function importDraftTableRequest($table_id_or_name, $config = null, $file } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3722,7 +3722,7 @@ public function publishDraftTableRequest($table_id_or_name, $include_foreign_ids } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4098,7 +4098,7 @@ public function readDraftTableRowsRequest($table_id_or_name, $after = null, $arc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4351,7 +4351,7 @@ public function removeTableVersionRequest($table_id_or_name, $version_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4652,7 +4652,7 @@ public function resetDraftTableRequest($table_id_or_name, $include_foreign_ids = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4953,7 +4953,7 @@ public function unpublishTableRequest($table_id_or_name, $include_foreign_ids = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5282,7 +5282,7 @@ public function updateDraftTableRequest($table_id_or_name, $hub_db_table_v3_requ if (isset($hub_db_table_v3_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_db_table_v3_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_db_table_v3_request; } @@ -5303,7 +5303,7 @@ public function updateDraftTableRequest($table_id_or_name, $hub_db_table_v3_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/ABTestsApi.php b/codegen/Cms/Pages/Api/ABTestsApi.php index 6e9702a6..f06caad0 100644 --- a/codegen/Cms/Pages/Api/ABTestsApi.php +++ b/codegen/Cms/Pages/Api/ABTestsApi.php @@ -370,7 +370,7 @@ public function createABTestVariationRequest($ab_test_create_request_v_next, str if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -391,7 +391,7 @@ public function createABTestVariationRequest($ab_test_create_request_v_next, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -655,7 +655,7 @@ public function createABTestVariation_0Request($ab_test_create_request_v_next, s if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -676,7 +676,7 @@ public function createABTestVariation_0Request($ab_test_create_request_v_next, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -884,7 +884,7 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont if (isset($ab_test_end_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_end_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_end_request_v_next; } @@ -905,7 +905,7 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1113,7 +1113,7 @@ public function endActiveABTest_0Request($ab_test_end_request_v_next, string $co if (isset($ab_test_end_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_end_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_end_request_v_next; } @@ -1134,7 +1134,7 @@ public function endActiveABTest_0Request($ab_test_end_request_v_next, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1342,7 +1342,7 @@ public function rerunPreviousABTestRequest($ab_test_rerun_request_v_next, string if (isset($ab_test_rerun_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_rerun_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_rerun_request_v_next; } @@ -1363,7 +1363,7 @@ public function rerunPreviousABTestRequest($ab_test_rerun_request_v_next, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1571,7 +1571,7 @@ public function rerunPreviousABTest_0Request($ab_test_rerun_request_v_next, stri if (isset($ab_test_rerun_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_rerun_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_rerun_request_v_next; } @@ -1592,7 +1592,7 @@ public function rerunPreviousABTest_0Request($ab_test_rerun_request_v_next, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/AdvancedApi.php b/codegen/Cms/Pages/Api/AdvancedApi.php index 7d0c437a..01fc91c2 100644 --- a/codegen/Cms/Pages/Api/AdvancedApi.php +++ b/codegen/Cms/Pages/Api/AdvancedApi.php @@ -409,7 +409,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -740,7 +740,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1046,7 +1046,7 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1352,7 +1352,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1658,7 +1658,7 @@ public function restorePreviousVersion_0Request($object_id, $revision_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/BasicApi.php b/codegen/Cms/Pages/Api/BasicApi.php index 5cb254be..2a3e67ab 100644 --- a/codegen/Cms/Pages/Api/BasicApi.php +++ b/codegen/Cms/Pages/Api/BasicApi.php @@ -541,7 +541,7 @@ public function cmsPagesV3LandingPagesCursorRequest($after = null, $archived = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -964,7 +964,7 @@ public function cmsPagesV3LandingPagesCursorQueryRequest($after = null, $archive } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1387,7 +1387,7 @@ public function cmsPagesV3LandingPagesFoldersCursorRequest($after = null, $archi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1810,7 +1810,7 @@ public function cmsPagesV3LandingPagesFoldersCursorQueryRequest($after = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2233,7 +2233,7 @@ public function cmsPagesV3SitePagesCursorRequest($after = null, $archived = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2656,7 +2656,7 @@ public function cmsPagesV3SitePagesCursorQueryRequest($after = null, $archived = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2962,7 +2962,7 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3293,7 +3293,7 @@ public function getPreviousVersionsRequest($object_id, $after = null, $before = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3523,7 +3523,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3829,7 +3829,7 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/BatchApi.php b/codegen/Cms/Pages/Api/BatchApi.php index 090c22b4..48338076 100644 --- a/codegen/Cms/Pages/Api/BatchApi.php +++ b/codegen/Cms/Pages/Api/BatchApi.php @@ -329,7 +329,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -350,7 +350,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -558,7 +558,7 @@ public function archiveBatch_0Request($batch_input_string, string $contentType = if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -579,7 +579,7 @@ public function archiveBatch_0Request($batch_input_string, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -787,7 +787,7 @@ public function archiveFoldersRequest($batch_input_string, string $contentType = if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -808,7 +808,7 @@ public function archiveFoldersRequest($batch_input_string, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1086,7 +1086,7 @@ public function createBatchRequest($batch_input_page, string $contentType = self if (isset($batch_input_page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_page), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_page; } @@ -1107,7 +1107,7 @@ public function createBatchRequest($batch_input_page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1385,7 +1385,7 @@ public function createBatch_0Request($batch_input_page, string $contentType = se if (isset($batch_input_page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_page), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_page; } @@ -1406,7 +1406,7 @@ public function createBatch_0Request($batch_input_page, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1684,7 +1684,7 @@ public function createFoldersRequest($batch_input_content_folder, string $conten if (isset($batch_input_content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_content_folder), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_content_folder; } @@ -1705,7 +1705,7 @@ public function createFoldersRequest($batch_input_content_folder, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1998,7 +1998,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2019,7 +2019,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2312,7 +2312,7 @@ public function readBatch_0Request($batch_input_string, $archived = null, string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2333,7 +2333,7 @@ public function readBatch_0Request($batch_input_string, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2626,7 +2626,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -2647,7 +2647,7 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2940,7 +2940,7 @@ public function updateBatch_0Request($batch_input_json_node, $archived = null, s 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -2961,7 +2961,7 @@ public function updateBatch_0Request($batch_input_json_node, $archived = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3254,7 +3254,7 @@ public function updateFoldersRequest($batch_input_json_node, $archived = null, s 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_json_node; } @@ -3275,7 +3275,7 @@ public function updateFoldersRequest($batch_input_json_node, $archived = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/FoldersApi.php b/codegen/Cms/Pages/Api/FoldersApi.php index 9763bf9b..426d2333 100644 --- a/codegen/Cms/Pages/Api/FoldersApi.php +++ b/codegen/Cms/Pages/Api/FoldersApi.php @@ -360,7 +360,7 @@ public function archiveFolderRequest($object_id, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -624,7 +624,7 @@ public function createFolderRequest($content_folder, string $contentType = self: if (isset($content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_folder), JSON_THROW_ON_ERROR); } else { $httpBody = $content_folder; } @@ -645,7 +645,7 @@ public function createFolderRequest($content_folder, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -961,7 +961,7 @@ public function getFolderByIdRequest($object_id, $archived = null, $property = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1267,7 +1267,7 @@ public function getFolderPreviousVersionRequest($object_id, $revision_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1598,7 +1598,7 @@ public function getFolderPreviousVersionsRequest($object_id, $after = null, $bef } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2029,7 +2029,7 @@ public function getFoldersPageRequest($after = null, $archived = null, $created_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2322,7 +2322,7 @@ public function readFoldersRequest($batch_input_string, $archived = null, string if (isset($batch_input_string)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_string), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_string; } @@ -2343,7 +2343,7 @@ public function readFoldersRequest($batch_input_string, $archived = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2649,7 +2649,7 @@ public function restoreFolderPreviousVersionRequest($object_id, $revision_id, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2948,7 +2948,7 @@ public function updateFolderRequest($object_id, $content_folder, $archived = nul if (isset($content_folder)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_folder), JSON_THROW_ON_ERROR); } else { $httpBody = $content_folder; } @@ -2969,7 +2969,7 @@ public function updateFolderRequest($object_id, $content_folder, $archived = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/LandingPagesApi.php b/codegen/Cms/Pages/Api/LandingPagesApi.php index 0dc34bdd..d38c1dca 100644 --- a/codegen/Cms/Pages/Api/LandingPagesApi.php +++ b/codegen/Cms/Pages/Api/LandingPagesApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -936,7 +936,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2429,7 +2429,7 @@ public function resetDraftRequest($object_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2658,7 +2658,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2957,7 +2957,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -2978,7 +2978,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3262,7 +3262,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -3283,7 +3283,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/MultiLanguageApi.php b/codegen/Cms/Pages/Api/MultiLanguageApi.php index 9667a793..702ed05c 100644 --- a/codegen/Cms/Pages/Api/MultiLanguageApi.php +++ b/codegen/Cms/Pages/Api/MultiLanguageApi.php @@ -365,7 +365,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -386,7 +386,7 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -636,7 +636,7 @@ public function attachToLangGroup_0Request($attach_to_lang_primary_request_v_nex 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $attach_to_lang_primary_request_v_next; } @@ -657,7 +657,7 @@ public function attachToLangGroup_0Request($attach_to_lang_primary_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -921,7 +921,7 @@ public function createLangVariationRequest($content_language_clone_request_v_nex if (isset($content_language_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_language_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_language_clone_request_v_next; } @@ -942,7 +942,7 @@ public function createLangVariationRequest($content_language_clone_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1206,7 +1206,7 @@ public function createLangVariation_0Request($content_language_clone_request_v_n if (isset($content_language_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_language_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_language_clone_request_v_next; } @@ -1227,7 +1227,7 @@ public function createLangVariation_0Request($content_language_clone_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1477,7 +1477,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -1498,7 +1498,7 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1748,7 +1748,7 @@ public function detachFromLangGroup_0Request($detach_from_lang_group_request_v_n 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $detach_from_lang_group_request_v_next; } @@ -1769,7 +1769,7 @@ public function detachFromLangGroup_0Request($detach_from_lang_group_request_v_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1977,7 +1977,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -1998,7 +1998,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2248,7 +2248,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -2269,7 +2269,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2519,7 +2519,7 @@ public function updateLangs_0Request($update_languages_request_v_next, string $c 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $update_languages_request_v_next; } @@ -2540,7 +2540,7 @@ public function updateLangs_0Request($update_languages_request_v_next, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/Pages/Api/WebsitePagesApi.php b/codegen/Cms/Pages/Api/WebsitePagesApi.php index 31d9f649..97c7ff3c 100644 --- a/codegen/Cms/Pages/Api/WebsitePagesApi.php +++ b/codegen/Cms/Pages/Api/WebsitePagesApi.php @@ -366,7 +366,7 @@ public function archiveRequest($object_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -630,7 +630,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_clone_request_v_next; } @@ -651,7 +651,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -915,7 +915,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -936,7 +936,7 @@ public function createRequest($page, string $contentType = self::contentTypes['c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1252,7 +1252,7 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1538,7 +1538,7 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1969,7 +1969,7 @@ public function getPageRequest($after = null, $archived = null, $created_after = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2199,7 +2199,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2407,7 +2407,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $content_schedule_request_v_next; } @@ -2428,7 +2428,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2636,7 +2636,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $set_new_language_primary_request_v_next; } @@ -2657,7 +2657,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2956,7 +2956,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -2977,7 +2977,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3261,7 +3261,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self if (isset($page)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($page), JSON_THROW_ON_ERROR); } else { $httpBody = $page; } @@ -3282,7 +3282,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SiteSearch/Api/BasicApi.php b/codegen/Cms/SiteSearch/Api/BasicApi.php index 516a5631..f810633a 100644 --- a/codegen/Cms/SiteSearch/Api/BasicApi.php +++ b/codegen/Cms/SiteSearch/Api/BasicApi.php @@ -395,7 +395,7 @@ public function getByIdRequest($content_id, $type = null, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SourceCode/Api/AdvancedApi.php b/codegen/Cms/SourceCode/Api/AdvancedApi.php index 359fad22..5e33e1e5 100644 --- a/codegen/Cms/SourceCode/Api/AdvancedApi.php +++ b/codegen/Cms/SourceCode/Api/AdvancedApi.php @@ -433,7 +433,7 @@ public function createRequest($environment, $path, $file = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -758,7 +758,7 @@ public function createOrUpdateRequest($environment, $path, $file = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1022,7 +1022,7 @@ public function doAsyncRequest($file_extract_request, string $contentType = self if (isset($file_extract_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($file_extract_request), JSON_THROW_ON_ERROR); } else { $httpBody = $file_extract_request; } @@ -1043,7 +1043,7 @@ public function doAsyncRequest($file_extract_request, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1357,7 +1357,7 @@ public function doValidateRequest($environment, $path, $file = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1643,7 +1643,7 @@ public function getAsyncStatusRequest($task_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/SourceCode/Api/BasicApi.php b/codegen/Cms/SourceCode/Api/BasicApi.php index f94b429a..a54878c5 100644 --- a/codegen/Cms/SourceCode/Api/BasicApi.php +++ b/codegen/Cms/SourceCode/Api/BasicApi.php @@ -350,7 +350,7 @@ public function archiveRequest($environment, $path, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -645,7 +645,7 @@ public function downloadRequest($environment, $path, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -969,7 +969,7 @@ public function getRequest($environment, $path, $properties = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Cms/UrlRedirects/Api/BasicApi.php b/codegen/Cms/UrlRedirects/Api/BasicApi.php index 67adced7..9271ef9d 100644 --- a/codegen/Cms/UrlRedirects/Api/BasicApi.php +++ b/codegen/Cms/UrlRedirects/Api/BasicApi.php @@ -333,7 +333,7 @@ public function archiveRequest($url_redirect_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -741,7 +741,7 @@ public function cmsUrlRedirectsV3Request($after = null, $archived = null, $creat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -997,7 +997,7 @@ public function cmsUrlRedirectsV3_0Request($url_mapping_create_request_body, str if (isset($url_mapping_create_request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($url_mapping_create_request_body), JSON_THROW_ON_ERROR); } else { $httpBody = $url_mapping_create_request_body; } @@ -1018,7 +1018,7 @@ public function cmsUrlRedirectsV3_0Request($url_mapping_create_request_body, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1304,7 +1304,7 @@ public function getByIdRequest($url_redirect_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1588,7 +1588,7 @@ public function updateRequest($url_redirect_id, $url_mapping, string $contentTyp if (isset($url_mapping)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($url_mapping), JSON_THROW_ON_ERROR); } else { $httpBody = $url_mapping; } @@ -1609,7 +1609,7 @@ public function updateRequest($url_redirect_id, $url_mapping, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/CommunicationPreferences/Api/AdvancedApi.php b/codegen/CommunicationPreferences/Api/AdvancedApi.php index cd52929b..b3c65eb4 100644 --- a/codegen/CommunicationPreferences/Api/AdvancedApi.php +++ b/codegen/CommunicationPreferences/Api/AdvancedApi.php @@ -350,7 +350,7 @@ public function subscribeRequest($public_update_subscription_status_request, str if (isset($public_update_subscription_status_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_update_subscription_status_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_update_subscription_status_request; } @@ -371,7 +371,7 @@ public function subscribeRequest($public_update_subscription_status_request, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -627,7 +627,7 @@ public function unsubscribeRequest($public_update_subscription_status_request, s if (isset($public_update_subscription_status_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_update_subscription_status_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_update_subscription_status_request; } @@ -648,7 +648,7 @@ public function unsubscribeRequest($public_update_subscription_status_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/CommunicationPreferences/Api/BasicApi.php b/codegen/CommunicationPreferences/Api/BasicApi.php index 45586c5b..8d2983d9 100644 --- a/codegen/CommunicationPreferences/Api/BasicApi.php +++ b/codegen/CommunicationPreferences/Api/BasicApi.php @@ -372,7 +372,7 @@ public function getEmailStatusRequest($email_address, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function getPageRequest(string $contentType = self::contentTypes['getPage } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Conversations/VisitorIdentification/Api/BasicApi.php b/codegen/Conversations/VisitorIdentification/Api/BasicApi.php index e14c7491..5b1e9f4a 100644 --- a/codegen/Conversations/VisitorIdentification/Api/BasicApi.php +++ b/codegen/Conversations/VisitorIdentification/Api/BasicApi.php @@ -355,7 +355,7 @@ public function generateTokenRequest($identification_token_generation_request, s if (isset($identification_token_generation_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($identification_token_generation_request), JSON_THROW_ON_ERROR); } else { $httpBody = $identification_token_generation_request; } @@ -376,7 +376,7 @@ public function generateTokenRequest($identification_token_generation_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/Api/BatchApi.php b/codegen/Crm/Associations/Api/BatchApi.php index 083e584e..0e84745f 100644 --- a/codegen/Crm/Associations/Api/BatchApi.php +++ b/codegen/Crm/Associations/Api/BatchApi.php @@ -345,7 +345,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_association)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association; } @@ -366,7 +366,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -684,7 +684,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p if (isset($batch_input_public_association)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association; } @@ -705,7 +705,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1023,7 +1023,7 @@ public function readRequest($from_object_type, $to_object_type, $batch_input_pub if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -1044,7 +1044,7 @@ public function readRequest($from_object_type, $to_object_type, $batch_input_pub } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/Schema/Api/BasicApi.php b/codegen/Crm/Associations/Schema/Api/BasicApi.php index 7b17e573..3ce0fca2 100644 --- a/codegen/Crm/Associations/Schema/Api/BasicApi.php +++ b/codegen/Crm/Associations/Schema/Api/BasicApi.php @@ -389,7 +389,7 @@ public function getAllRequest($from_object_type, $to_object_type, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Api/BasicApi.php b/codegen/Crm/Associations/V4/Api/BasicApi.php index 6b0d1b4f..ed0ba58f 100644 --- a/codegen/Crm/Associations/V4/Api/BasicApi.php +++ b/codegen/Crm/Associations/V4/Api/BasicApi.php @@ -390,7 +390,7 @@ public function archiveRequest($object_type, $object_id, $to_object_type, $to_ob } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -734,7 +734,7 @@ public function createRequest($object_type, $object_id, $to_object_type, $to_obj if (isset($association_spec)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($association_spec), JSON_THROW_ON_ERROR); } else { $httpBody = $association_spec; } @@ -755,7 +755,7 @@ public function createRequest($object_type, $object_id, $to_object_type, $to_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1101,7 +1101,7 @@ public function createDefaultRequest($from_object_type, $from_object_id, $to_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1457,7 +1457,7 @@ public function getPageRequest($object_type, $object_id, $to_object_type, $after } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Api/BatchApi.php b/codegen/Crm/Associations/V4/Api/BatchApi.php index 06143882..af8b1acf 100644 --- a/codegen/Crm/Associations/V4/Api/BatchApi.php +++ b/codegen/Crm/Associations/V4/Api/BatchApi.php @@ -351,7 +351,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_association_multi_archive)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_archive), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_archive; } @@ -372,7 +372,7 @@ public function archiveRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -620,7 +620,7 @@ public function archiveLabelsRequest($from_object_type, $to_object_type, $batch_ if (isset($batch_input_public_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_post; } @@ -641,7 +641,7 @@ public function archiveLabelsRequest($from_object_type, $to_object_type, $batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -959,7 +959,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p if (isset($batch_input_public_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_multi_post), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_multi_post; } @@ -980,7 +980,7 @@ public function createRequest($from_object_type, $to_object_type, $batch_input_p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1284,7 +1284,7 @@ public function createDefaultRequest($from_object_type, $to_object_type, $batch_ if (isset($batch_input_public_default_association_multi_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_default_association_multi_post), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_default_association_multi_post; } @@ -1305,7 +1305,7 @@ public function createDefaultRequest($from_object_type, $to_object_type, $batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1623,7 +1623,7 @@ public function getPageRequest($from_object_type, $to_object_type, $batch_input_ if (isset($batch_input_public_fetch_associations_batch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_fetch_associations_batch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_fetch_associations_batch_request; } @@ -1644,7 +1644,7 @@ public function getPageRequest($from_object_type, $to_object_type, $batch_input_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Api/ReportApi.php b/codegen/Crm/Associations/V4/Api/ReportApi.php index 5873160b..0eada690 100644 --- a/codegen/Crm/Associations/V4/Api/ReportApi.php +++ b/codegen/Crm/Associations/V4/Api/ReportApi.php @@ -377,7 +377,7 @@ public function requestRequest($user_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php b/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php index 2f600941..495bca22 100644 --- a/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php +++ b/codegen/Crm/Associations/V4/Schema/Api/LabelsApi.php @@ -404,7 +404,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_association_definition_create_request; } @@ -425,7 +425,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -731,7 +731,7 @@ public function getPageRequest($from_object_type, $to_object_type, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1001,7 +1001,7 @@ public function removeRequest($association_type_id, $from_object_type, $to_objec } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1249,7 +1249,7 @@ public function updateRequest($from_object_type, $to_object_type, $public_associ if (isset($public_association_definition_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_association_definition_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_association_definition_update_request; } @@ -1270,7 +1270,7 @@ public function updateRequest($from_object_type, $to_object_type, $public_associ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php b/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php index ddac8a9b..436b4278 100644 --- a/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php +++ b/codegen/Crm/Associations/V4/Schema/Api/LimitsApi.php @@ -421,7 +421,7 @@ public function batchCreateRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_definition_configuration_create_request; } @@ -442,7 +442,7 @@ public function batchCreateRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -690,7 +690,7 @@ public function batchRemoveRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_spec), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_spec; } @@ -711,7 +711,7 @@ public function batchRemoveRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1029,7 +1029,7 @@ public function batchUpdateRequest($from_object_type, $to_object_type, $batch_in 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_association_definition_configuration_update_request; } @@ -1050,7 +1050,7 @@ public function batchUpdateRequest($from_object_type, $to_object_type, $batch_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1316,7 +1316,7 @@ public function getPageRequest(string $contentType = self::contentTypes['getPage } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1622,7 +1622,7 @@ public function getPageBetweenTwoObjectTypesRequest($from_object_type, $to_objec } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php index 1a9f02ea..3ab49aca 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BasicApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($invoice_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($invoice_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($invoice_id, $simple_public_object_input, $id_prop 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($invoice_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php index 8fde48fb..59159817 100644 --- a/codegen/Crm/Commerce/Invoices/Api/BatchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php index 3cf0d877..24c26c54 100644 --- a/codegen/Crm/Commerce/Invoices/Api/SearchApi.php +++ b/codegen/Crm/Commerce/Invoices/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Companies/Api/AdvancedApi.php b/codegen/Crm/Companies/Api/AdvancedApi.php index 86ef69e3..ebfb8df4 100644 --- a/codegen/Crm/Companies/Api/AdvancedApi.php +++ b/codegen/Crm/Companies/Api/AdvancedApi.php @@ -355,7 +355,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -376,7 +376,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Companies/Api/BasicApi.php b/codegen/Crm/Companies/Api/BasicApi.php index 93e168f6..31bb3450 100644 --- a/codegen/Crm/Companies/Api/BasicApi.php +++ b/codegen/Crm/Companies/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($company_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($company_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($company_id, $simple_public_object_input, $id_prop 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($company_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Companies/Api/BatchApi.php b/codegen/Crm/Companies/Api/BatchApi.php index 3acab104..a42b696e 100644 --- a/codegen/Crm/Companies/Api/BatchApi.php +++ b/codegen/Crm/Companies/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Companies/Api/SearchApi.php b/codegen/Crm/Companies/Api/SearchApi.php index bdf232d1..7a03f35a 100644 --- a/codegen/Crm/Companies/Api/SearchApi.php +++ b/codegen/Crm/Companies/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Contacts/Api/AdvancedApi.php b/codegen/Crm/Contacts/Api/AdvancedApi.php index a5b9b59a..30c26fcd 100644 --- a/codegen/Crm/Contacts/Api/AdvancedApi.php +++ b/codegen/Crm/Contacts/Api/AdvancedApi.php @@ -358,7 +358,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -379,7 +379,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -583,7 +583,7 @@ public function purgeRequest($public_gdpr_delete_input, string $contentType = se 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_gdpr_delete_input; } @@ -604,7 +604,7 @@ public function purgeRequest($public_gdpr_delete_input, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Contacts/Api/BasicApi.php b/codegen/Crm/Contacts/Api/BasicApi.php index 42b89974..8c47080e 100644 --- a/codegen/Crm/Contacts/Api/BasicApi.php +++ b/codegen/Crm/Contacts/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($contact_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($contact_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($contact_id, $simple_public_object_input, $id_prop 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($contact_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Contacts/Api/BatchApi.php b/codegen/Crm/Contacts/Api/BatchApi.php index 041e0881..6091ddd4 100644 --- a/codegen/Crm/Contacts/Api/BatchApi.php +++ b/codegen/Crm/Contacts/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Contacts/Api/SearchApi.php b/codegen/Crm/Contacts/Api/SearchApi.php index 8e443d54..54953daa 100644 --- a/codegen/Crm/Contacts/Api/SearchApi.php +++ b/codegen/Crm/Contacts/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Deals/Api/BasicApi.php b/codegen/Crm/Deals/Api/BasicApi.php index 4ddc1fa6..bd0aa1a1 100644 --- a/codegen/Crm/Deals/Api/BasicApi.php +++ b/codegen/Crm/Deals/Api/BasicApi.php @@ -339,7 +339,7 @@ public function archiveRequest($deal_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -599,7 +599,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -620,7 +620,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -980,7 +980,7 @@ public function getByIdRequest($deal_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1332,7 +1332,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1592,7 +1592,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -1613,7 +1613,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1911,7 +1911,7 @@ public function updateRequest($deal_id, $simple_public_object_input, $id_propert 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1932,7 +1932,7 @@ public function updateRequest($deal_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Deals/Api/BatchApi.php b/codegen/Crm/Deals/Api/BatchApi.php index a5bd65cd..24c931a3 100644 --- a/codegen/Crm/Deals/Api/BatchApi.php +++ b/codegen/Crm/Deals/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Deals/Api/SearchApi.php b/codegen/Crm/Deals/Api/SearchApi.php index bafd75b7..3fbdb38a 100644 --- a/codegen/Crm/Deals/Api/SearchApi.php +++ b/codegen/Crm/Deals/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Exports/Api/AdvancedApi.php b/codegen/Crm/Exports/Api/AdvancedApi.php index 5c87a170..b32e13d0 100644 --- a/codegen/Crm/Exports/Api/AdvancedApi.php +++ b/codegen/Crm/Exports/Api/AdvancedApi.php @@ -380,7 +380,7 @@ public function getStatusRequest($task_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -644,7 +644,7 @@ public function startRequest($public_export_request, string $contentType = self: if (isset($public_export_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_export_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_export_request; } @@ -665,7 +665,7 @@ public function startRequest($public_export_request, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Exports/Api/BasicApi.php b/codegen/Crm/Exports/Api/BasicApi.php index b94755cf..cbe1fa2f 100644 --- a/codegen/Crm/Exports/Api/BasicApi.php +++ b/codegen/Crm/Exports/Api/BasicApi.php @@ -377,7 +377,7 @@ public function getByIdRequest($export_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php b/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php index 125c719d..a61ceb5e 100644 --- a/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php +++ b/codegen/Crm/Extensions/Calling/Api/AdvancedApi.php @@ -358,7 +358,7 @@ public function crmV3ExtensionsCallingInboundCallRequest($completed_third_party_ if (isset($completed_third_party_call_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($completed_third_party_call_request), JSON_THROW_ON_ERROR); } else { $httpBody = $completed_third_party_call_request; } @@ -379,7 +379,7 @@ public function crmV3ExtensionsCallingInboundCallRequest($completed_third_party_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -587,7 +587,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con if (isset($mark_recording_as_ready_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($mark_recording_as_ready_request), JSON_THROW_ON_ERROR); } else { $httpBody = $mark_recording_as_ready_request; } @@ -608,7 +608,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Calling/Api/BasicApi.php b/codegen/Crm/Extensions/Calling/Api/BasicApi.php index cffa26e4..c3c79c22 100644 --- a/codegen/Crm/Extensions/Calling/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Calling/Api/BasicApi.php @@ -411,7 +411,7 @@ public function createRequest($app_id, $settings_request, string $contentType = if (isset($settings_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_request), JSON_THROW_ON_ERROR); } else { $httpBody = $settings_request; } @@ -432,7 +432,7 @@ public function createRequest($app_id, $settings_request, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -717,7 +717,7 @@ public function create_0Request($app_id, $channel_connection_settings_request, s 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_request), JSON_THROW_ON_ERROR); } else { $httpBody = $channel_connection_settings_request; } @@ -738,7 +738,7 @@ public function create_0Request($app_id, $channel_connection_settings_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1023,7 +1023,7 @@ public function create_1Request($app_id, $recording_settings_request, string $co if (isset($recording_settings_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($recording_settings_request), JSON_THROW_ON_ERROR); } else { $httpBody = $recording_settings_request; } @@ -1044,7 +1044,7 @@ public function create_1Request($app_id, $recording_settings_request, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1318,7 +1318,7 @@ public function crmExtensionsCallingV3ConnectionStatusesRequest($user_id = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1576,7 +1576,7 @@ public function crmExtensionsCallingV3ConnectionStatusesMeRequest(string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1862,7 +1862,7 @@ public function getRequest($app_id, string $contentType = self::contentTypes['ge } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2149,7 +2149,7 @@ public function get_0Request($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2436,7 +2436,7 @@ public function get_1Request($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2667,7 +2667,7 @@ public function removeRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2898,7 +2898,7 @@ public function remove_0Request($app_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3183,7 +3183,7 @@ public function updateRequest($app_id, $settings_patch_request, string $contentT if (isset($settings_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $settings_patch_request; } @@ -3204,7 +3204,7 @@ public function updateRequest($app_id, $settings_patch_request, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3489,7 +3489,7 @@ public function update_0Request($app_id, $channel_connection_settings_patch_requ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $channel_connection_settings_patch_request; } @@ -3510,7 +3510,7 @@ public function update_0Request($app_id, $channel_connection_settings_patch_requ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3795,7 +3795,7 @@ public function update_1Request($app_id, $recording_settings_patch_request, stri if (isset($recording_settings_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($recording_settings_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $recording_settings_patch_request; } @@ -3816,7 +3816,7 @@ public function update_1Request($app_id, $recording_settings_patch_request, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Calling/Api/BatchApi.php b/codegen/Crm/Extensions/Calling/Api/BatchApi.php index 66c9c1e3..5a2b1314 100644 --- a/codegen/Crm/Extensions/Calling/Api/BatchApi.php +++ b/codegen/Crm/Extensions/Calling/Api/BatchApi.php @@ -347,7 +347,7 @@ public function crmExtensionsCallingV3ConnectionStatusesBatchReadRequest($batch_ if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -368,7 +368,7 @@ public function crmExtensionsCallingV3ConnectionStatusesBatchReadRequest($batch_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php b/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php index f99bfea7..cffc7479 100644 --- a/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php +++ b/codegen/Crm/Extensions/Cards/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function crmV3ExtensionsCardsDevAppIdViewsMigrateRequest($app_id, $card_m if (isset($card_migrate_views_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_migrate_views_request), JSON_THROW_ON_ERROR); } else { $httpBody = $card_migrate_views_request; } @@ -396,7 +396,7 @@ public function crmV3ExtensionsCardsDevAppIdViewsMigrateRequest($app_id, $card_m } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Cards/Api/BasicApi.php b/codegen/Crm/Extensions/Cards/Api/BasicApi.php index fcb173db..15c54ffb 100644 --- a/codegen/Crm/Extensions/Cards/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Cards/Api/BasicApi.php @@ -356,7 +356,7 @@ public function archiveRequest($app_id, $card_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -641,7 +641,7 @@ public function createRequest($app_id, $card_create_request, string $contentType if (isset($card_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $card_create_request; } @@ -662,7 +662,7 @@ public function createRequest($app_id, $card_create_request, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -949,7 +949,7 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1256,7 +1256,7 @@ public function getByIdRequest($app_id, $card_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1523,7 +1523,7 @@ public function getCardsSampleResponseRequest(string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1823,7 +1823,7 @@ public function updateRequest($app_id, $card_id, $card_patch_request, string $co if (isset($card_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($card_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $card_patch_request; } @@ -1844,7 +1844,7 @@ public function updateRequest($app_id, $card_id, $card_patch_request, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php b/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php index 551c4a49..66f1b735 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php +++ b/codegen/Crm/Extensions/Videoconferencing/Api/BasicApi.php @@ -327,7 +327,7 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -614,7 +614,7 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -899,7 +899,7 @@ public function replaceRequest($app_id, $external_settings, string $contentType if (isset($external_settings)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($external_settings), JSON_THROW_ON_ERROR); } else { $httpBody = $external_settings; } @@ -920,7 +920,7 @@ public function replaceRequest($app_id, $external_settings, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Imports/Api/AdvancedApi.php b/codegen/Crm/Imports/Api/AdvancedApi.php index 96f62220..760a9d3e 100644 --- a/codegen/Crm/Imports/Api/AdvancedApi.php +++ b/codegen/Crm/Imports/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function crmV3ImportsRequest($files = null, $import_request = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -661,7 +661,7 @@ public function crmV3ImportsImportIdCancelRequest($import_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Imports/Api/BasicApi.php b/codegen/Crm/Imports/Api/BasicApi.php index 8600097f..21d2545b 100644 --- a/codegen/Crm/Imports/Api/BasicApi.php +++ b/codegen/Crm/Imports/Api/BasicApi.php @@ -385,7 +385,7 @@ public function crmV3ImportsRequest($after = null, $limit = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -671,7 +671,7 @@ public function crmV3ImportsImportIdRequest($import_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1017,7 +1017,7 @@ public function crmV3ImportsImportIdErrorsRequest($import_id, $after = null, $in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/LineItems/Api/BasicApi.php b/codegen/Crm/LineItems/Api/BasicApi.php index 42dcaf99..b37eb40f 100644 --- a/codegen/Crm/LineItems/Api/BasicApi.php +++ b/codegen/Crm/LineItems/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($line_item_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($line_item_id, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($line_item_id, $simple_public_object_input, $id_pr 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($line_item_id, $simple_public_object_input, $id_pr } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/LineItems/Api/BatchApi.php b/codegen/Crm/LineItems/Api/BatchApi.php index 7ee93fa7..2c550790 100644 --- a/codegen/Crm/LineItems/Api/BatchApi.php +++ b/codegen/Crm/LineItems/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/LineItems/Api/SearchApi.php b/codegen/Crm/LineItems/Api/SearchApi.php index 190090a5..3013b078 100644 --- a/codegen/Crm/LineItems/Api/SearchApi.php +++ b/codegen/Crm/LineItems/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Api/BasicApi.php b/codegen/Crm/Lists/Api/BasicApi.php index 5bd0aae0..d6a49dd3 100644 --- a/codegen/Crm/Lists/Api/BasicApi.php +++ b/codegen/Crm/Lists/Api/BasicApi.php @@ -460,7 +460,7 @@ public function crmV3ListsRequest($include_filters = false, $list_ids = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -741,7 +741,7 @@ public function crmV3ListsFoldersRequest($folder_id = '0', string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -971,7 +971,7 @@ public function crmV3ListsFoldersFolderIdRequest($folder_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1277,7 +1277,7 @@ public function crmV3ListsFoldersFolderIdMoveNewParentFolderIdRequest($folder_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1578,7 +1578,7 @@ public function crmV3ListsFoldersFolderIdRenameRequest($folder_id, $new_folder_n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1786,7 +1786,7 @@ public function crmV3ListsFoldersMoveListRequest($list_move_request, string $con if (isset($list_move_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_move_request), JSON_THROW_ON_ERROR); } else { $httpBody = $list_move_request; } @@ -1807,7 +1807,7 @@ public function crmV3ListsFoldersMoveListRequest($list_move_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2071,7 +2071,7 @@ public function crmV3ListsFolders_0Request($list_folder_create_request, string $ if (isset($list_folder_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_folder_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $list_folder_create_request; } @@ -2092,7 +2092,7 @@ public function crmV3ListsFolders_0Request($list_folder_create_request, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2373,7 +2373,7 @@ public function crmV3ListsIdmappingRequest($legacy_list_id = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2637,7 +2637,7 @@ public function crmV3ListsIdmapping_0Request($request_body, string $contentType if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -2658,7 +2658,7 @@ public function crmV3ListsIdmapping_0Request($request_body, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2959,7 +2959,7 @@ public function crmV3ListsListIdRequest($list_id, $include_filters = false, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3290,7 +3290,7 @@ public function crmV3ListsListIdMembershipsRequest($list_id, $after = null, $bef } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3574,7 +3574,7 @@ public function crmV3ListsListIdMembershipsAddRequest($list_id, $request_body, s if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -3595,7 +3595,7 @@ public function crmV3ListsListIdMembershipsAddRequest($list_id, $request_body, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3879,7 +3879,7 @@ public function crmV3ListsListIdMembershipsAddAndRemoveRequest($list_id, $member if (isset($membership_change_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($membership_change_request), JSON_THROW_ON_ERROR); } else { $httpBody = $membership_change_request; } @@ -3900,7 +3900,7 @@ public function crmV3ListsListIdMembershipsAddAndRemoveRequest($list_id, $member } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4150,7 +4150,7 @@ public function crmV3ListsListIdMembershipsAddFromSourceListIdRequest($list_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4481,7 +4481,7 @@ public function crmV3ListsListIdMembershipsJoinOrderRequest($list_id, $after = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4765,7 +4765,7 @@ public function crmV3ListsListIdMembershipsRemoveRequest($list_id, $request_body if (isset($request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body), JSON_THROW_ON_ERROR); } else { $httpBody = $request_body; } @@ -4786,7 +4786,7 @@ public function crmV3ListsListIdMembershipsRemoveRequest($list_id, $request_body } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5016,7 +5016,7 @@ public function crmV3ListsListIdMemberships_0Request($list_id, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5246,7 +5246,7 @@ public function crmV3ListsListIdRestoreRequest($list_id, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5532,7 +5532,7 @@ public function crmV3ListsListIdScheduleConversionRequest($list_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5816,7 +5816,7 @@ public function crmV3ListsListIdScheduleConversion_0Request($list_id, $public_li if (isset($public_list_conversion_time)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_list_conversion_time), JSON_THROW_ON_ERROR); } else { $httpBody = $public_list_conversion_time; } @@ -5837,7 +5837,7 @@ public function crmV3ListsListIdScheduleConversion_0Request($list_id, $public_li } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6067,7 +6067,7 @@ public function crmV3ListsListIdScheduleConversion_1Request($list_id, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6375,7 +6375,7 @@ public function crmV3ListsListIdSizeAndEditsHistoryBetweenRequest($list_id, $end } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6674,7 +6674,7 @@ public function crmV3ListsListIdUpdateListFiltersRequest($list_id, $list_filter_ if (isset($list_filter_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_filter_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $list_filter_update_request; } @@ -6695,7 +6695,7 @@ public function crmV3ListsListIdUpdateListFiltersRequest($list_id, $list_filter_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7011,7 +7011,7 @@ public function crmV3ListsListIdUpdateListNameRequest($list_id, $include_filters } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7241,7 +7241,7 @@ public function crmV3ListsListId_0Request($list_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7562,7 +7562,7 @@ public function crmV3ListsObjectTypeIdObjectTypeIdNameListNameRequest($list_name } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7868,7 +7868,7 @@ public function crmV3ListsRecordsObjectTypeIdRecordIdMembershipsRequest($object_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -8124,7 +8124,7 @@ public function crmV3Lists_0Request($list_create_request, string $contentType = if (isset($list_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $list_create_request; } @@ -8145,7 +8145,7 @@ public function crmV3Lists_0Request($list_create_request, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Api/BatchApi.php b/codegen/Crm/Lists/Api/BatchApi.php index 1d74e34e..4a84bccf 100644 --- a/codegen/Crm/Lists/Api/BatchApi.php +++ b/codegen/Crm/Lists/Api/BatchApi.php @@ -361,7 +361,7 @@ public function crmV3ListsRecordsMembershipsBatchReadRequest($batch_input_record if (isset($batch_input_record_id_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_record_id_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_record_id_input; } @@ -382,7 +382,7 @@ public function crmV3ListsRecordsMembershipsBatchReadRequest($batch_input_record } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Lists/Api/SearchApi.php b/codegen/Crm/Lists/Api/SearchApi.php index d9d33278..c2174391 100644 --- a/codegen/Crm/Lists/Api/SearchApi.php +++ b/codegen/Crm/Lists/Api/SearchApi.php @@ -355,7 +355,7 @@ public function crmV3ListsSearchRequest($list_search_request, string $contentTyp if (isset($list_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $list_search_request; } @@ -376,7 +376,7 @@ public function crmV3ListsSearchRequest($list_search_request, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/AdvancedApi.php b/codegen/Crm/Objects/Api/AdvancedApi.php index 93efb6ed..67a450bb 100644 --- a/codegen/Crm/Objects/Api/AdvancedApi.php +++ b/codegen/Crm/Objects/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function mergeRequest($object_type, $public_merge_input, string $contentT if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -396,7 +396,7 @@ public function mergeRequest($object_type, $public_merge_input, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/BasicApi.php b/codegen/Crm/Objects/Api/BasicApi.php index a0471120..707f5fa4 100644 --- a/codegen/Crm/Objects/Api/BasicApi.php +++ b/codegen/Crm/Objects/Api/BasicApi.php @@ -353,7 +353,7 @@ public function archiveRequest($object_id, $object_type, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function createRequest($object_type, $simple_public_object_input_for_crea 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -658,7 +658,7 @@ public function createRequest($object_type, $simple_public_object_input_for_crea } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1039,7 +1039,7 @@ public function getByIdRequest($object_id, $object_type, $archived = false, $ass } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1415,7 +1415,7 @@ public function getPageRequest($object_type, $after = null, $archived = false, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1734,7 +1734,7 @@ public function updateRequest($object_id, $object_type, $simple_public_object_in 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1755,7 +1755,7 @@ public function updateRequest($object_id, $object_type, $simple_public_object_in } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/BatchApi.php b/codegen/Crm/Objects/Api/BatchApi.php index c6769012..6d547153 100644 --- a/codegen/Crm/Objects/Api/BatchApi.php +++ b/codegen/Crm/Objects/Api/BatchApi.php @@ -331,7 +331,7 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -352,7 +352,7 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -650,7 +650,7 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -671,7 +671,7 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -969,7 +969,7 @@ public function postCrmV3ObjectsObjectTypeBatchUpsertRequest($object_type, $batc 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -990,7 +990,7 @@ public function postCrmV3ObjectsObjectTypeBatchUpsertRequest($object_type, $batc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1303,7 +1303,7 @@ public function readRequest($object_type, $batch_read_input_simple_public_object 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -1324,7 +1324,7 @@ public function readRequest($object_type, $batch_read_input_simple_public_object } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1622,7 +1622,7 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1643,7 +1643,7 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Api/SearchApi.php b/codegen/Crm/Objects/Api/SearchApi.php index cdb64be6..42e63710 100644 --- a/codegen/Crm/Objects/Api/SearchApi.php +++ b/codegen/Crm/Objects/Api/SearchApi.php @@ -375,7 +375,7 @@ public function doSearchRequest($object_type, $public_object_search_request, str if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -396,7 +396,7 @@ public function doSearchRequest($object_type, $public_object_search_request, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Calls/Api/BasicApi.php b/codegen/Crm/Objects/Calls/Api/BasicApi.php index c6ce36da..0662c37d 100644 --- a/codegen/Crm/Objects/Calls/Api/BasicApi.php +++ b/codegen/Crm/Objects/Calls/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($call_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($call_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($call_id, $simple_public_object_input, $id_propert 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($call_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Calls/Api/BatchApi.php b/codegen/Crm/Objects/Calls/Api/BatchApi.php index d6f40100..83ad53de 100644 --- a/codegen/Crm/Objects/Calls/Api/BatchApi.php +++ b/codegen/Crm/Objects/Calls/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Calls/Api/SearchApi.php b/codegen/Crm/Objects/Calls/Api/SearchApi.php index 00f0fd93..e178adcd 100644 --- a/codegen/Crm/Objects/Calls/Api/SearchApi.php +++ b/codegen/Crm/Objects/Calls/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Communications/Api/BasicApi.php b/codegen/Crm/Objects/Communications/Api/BasicApi.php index 7d13c46b..93033b3b 100644 --- a/codegen/Crm/Objects/Communications/Api/BasicApi.php +++ b/codegen/Crm/Objects/Communications/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($communication_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($communication_id, $archived = false, $associatio } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($communication_id, $simple_public_object_input, $i 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($communication_id, $simple_public_object_input, $i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Communications/Api/BatchApi.php b/codegen/Crm/Objects/Communications/Api/BatchApi.php index a5d2f132..d079c1da 100644 --- a/codegen/Crm/Objects/Communications/Api/BatchApi.php +++ b/codegen/Crm/Objects/Communications/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Communications/Api/SearchApi.php b/codegen/Crm/Objects/Communications/Api/SearchApi.php index a0b4550b..d28d64bf 100644 --- a/codegen/Crm/Objects/Communications/Api/SearchApi.php +++ b/codegen/Crm/Objects/Communications/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php index 7724d7be..c0ca7593 100644 --- a/codegen/Crm/Objects/DealSplits/Api/BatchApi.php +++ b/codegen/Crm/Objects/DealSplits/Api/BatchApi.php @@ -372,7 +372,7 @@ public function crmObjectsV3DealsSplitsBatchReadRequest($batch_input_public_obje if (isset($batch_input_public_object_id)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_public_object_id; } @@ -393,7 +393,7 @@ public function crmObjectsV3DealsSplitsBatchReadRequest($batch_input_public_obje } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -671,7 +671,7 @@ public function crmObjectsV3DealsSplitsBatchUpsertRequest($public_deal_splits_ba if (isset($public_deal_splits_batch_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_deal_splits_batch_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_deal_splits_batch_create_request; } @@ -692,7 +692,7 @@ public function crmObjectsV3DealsSplitsBatchUpsertRequest($public_deal_splits_ba } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Emails/Api/BasicApi.php b/codegen/Crm/Objects/Emails/Api/BasicApi.php index eb45908e..0aa8b3dd 100644 --- a/codegen/Crm/Objects/Emails/Api/BasicApi.php +++ b/codegen/Crm/Objects/Emails/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($email_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($email_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Emails/Api/BatchApi.php b/codegen/Crm/Objects/Emails/Api/BatchApi.php index d914e2d8..0401cedc 100644 --- a/codegen/Crm/Objects/Emails/Api/BatchApi.php +++ b/codegen/Crm/Objects/Emails/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Emails/Api/SearchApi.php b/codegen/Crm/Objects/Emails/Api/SearchApi.php index 34250807..a9af2239 100644 --- a/codegen/Crm/Objects/Emails/Api/SearchApi.php +++ b/codegen/Crm/Objects/Emails/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php index fa9fcb50..d987a4d7 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php @@ -458,7 +458,7 @@ public function getByIdRequest($feedback_submission_id, $archived = false, $asso } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -810,7 +810,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php index b4e8cc04..b77c81dd 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php @@ -384,7 +384,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -405,7 +405,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php index d9608d15..8b2f76f0 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Goals/Api/BasicApi.php b/codegen/Crm/Objects/Goals/Api/BasicApi.php index a8a5787f..308585a0 100644 --- a/codegen/Crm/Objects/Goals/Api/BasicApi.php +++ b/codegen/Crm/Objects/Goals/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($goal_target_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($goal_target_id, $archived = false, $associations } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($goal_target_id, $simple_public_object_input, $id_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($goal_target_id, $simple_public_object_input, $id_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Goals/Api/BatchApi.php b/codegen/Crm/Objects/Goals/Api/BatchApi.php index 0376a362..2c276492 100644 --- a/codegen/Crm/Objects/Goals/Api/BatchApi.php +++ b/codegen/Crm/Objects/Goals/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Goals/Api/SearchApi.php b/codegen/Crm/Objects/Goals/Api/SearchApi.php index 61d2b179..9b8aace2 100644 --- a/codegen/Crm/Objects/Goals/Api/SearchApi.php +++ b/codegen/Crm/Objects/Goals/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Leads/Api/BasicApi.php b/codegen/Crm/Objects/Leads/Api/BasicApi.php index 8d65d545..ffb54071 100644 --- a/codegen/Crm/Objects/Leads/Api/BasicApi.php +++ b/codegen/Crm/Objects/Leads/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($leads_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($leads_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($leads_id, $simple_public_object_input, $id_proper 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($leads_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Leads/Api/BatchApi.php b/codegen/Crm/Objects/Leads/Api/BatchApi.php index d4d3b7d7..d5917738 100644 --- a/codegen/Crm/Objects/Leads/Api/BatchApi.php +++ b/codegen/Crm/Objects/Leads/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Leads/Api/SearchApi.php b/codegen/Crm/Objects/Leads/Api/SearchApi.php index e39c8ef8..ec45e2bd 100644 --- a/codegen/Crm/Objects/Leads/Api/SearchApi.php +++ b/codegen/Crm/Objects/Leads/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Meetings/Api/BasicApi.php b/codegen/Crm/Objects/Meetings/Api/BasicApi.php index e689d86b..221bd5de 100644 --- a/codegen/Crm/Objects/Meetings/Api/BasicApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($meeting_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($meeting_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Meetings/Api/BatchApi.php b/codegen/Crm/Objects/Meetings/Api/BatchApi.php index 8f1bf07c..09d11762 100644 --- a/codegen/Crm/Objects/Meetings/Api/BatchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Meetings/Api/SearchApi.php b/codegen/Crm/Objects/Meetings/Api/SearchApi.php index 981b6cff..acd62339 100644 --- a/codegen/Crm/Objects/Meetings/Api/SearchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/SearchApi.php @@ -347,7 +347,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -368,7 +368,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Notes/Api/BasicApi.php b/codegen/Crm/Objects/Notes/Api/BasicApi.php index 8534806e..70255f25 100644 --- a/codegen/Crm/Objects/Notes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Notes/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($note_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($note_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Notes/Api/BatchApi.php b/codegen/Crm/Objects/Notes/Api/BatchApi.php index 35aec598..812715d0 100644 --- a/codegen/Crm/Objects/Notes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Notes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Notes/Api/SearchApi.php b/codegen/Crm/Objects/Notes/Api/SearchApi.php index 08233a58..0f8ea296 100644 --- a/codegen/Crm/Objects/Notes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Notes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php index ec78a583..7f35ffb3 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php @@ -328,7 +328,7 @@ public function archiveRequest($postal_mail_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -580,7 +580,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -601,7 +601,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -953,7 +953,7 @@ public function getByIdRequest($postal_mail_id, $archived = false, $associations } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1297,7 +1297,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1587,7 +1587,7 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1608,7 +1608,7 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php index 59c55c0d..d6f74bec 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php @@ -303,7 +303,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -324,7 +324,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -590,7 +590,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -611,7 +611,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -892,7 +892,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -913,7 +913,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1179,7 +1179,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1200,7 +1200,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1466,7 +1466,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1487,7 +1487,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php index 5f47233e..d469bb2f 100644 --- a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php @@ -347,7 +347,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -368,7 +368,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Tasks/Api/BasicApi.php b/codegen/Crm/Objects/Tasks/Api/BasicApi.php index 98d9c6fa..962ecc29 100644 --- a/codegen/Crm/Objects/Tasks/Api/BasicApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($task_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($task_id, $archived = false, $associations = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Tasks/Api/BatchApi.php b/codegen/Crm/Objects/Tasks/Api/BatchApi.php index c11cc513..297fc4ae 100644 --- a/codegen/Crm/Objects/Tasks/Api/BatchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Tasks/Api/SearchApi.php b/codegen/Crm/Objects/Tasks/Api/SearchApi.php index 11fcb463..a14f4099 100644 --- a/codegen/Crm/Objects/Tasks/Api/SearchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Taxes/Api/BasicApi.php b/codegen/Crm/Objects/Taxes/Api/BasicApi.php index c46a96d9..2dec9e3a 100644 --- a/codegen/Crm/Objects/Taxes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($tax_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($tax_id, $archived = false, $associations = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Taxes/Api/BatchApi.php b/codegen/Crm/Objects/Taxes/Api/BatchApi.php index f4149613..d4d7c64d 100644 --- a/codegen/Crm/Objects/Taxes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Objects/Taxes/Api/SearchApi.php b/codegen/Crm/Objects/Taxes/Api/SearchApi.php index c141879b..2ce057e2 100644 --- a/codegen/Crm/Objects/Taxes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Owners/Api/BasicApi.php b/codegen/Crm/Owners/Api/BasicApi.php index e7a1c1b2..05c18237 100644 --- a/codegen/Crm/Owners/Api/BasicApi.php +++ b/codegen/Crm/Owners/Api/BasicApi.php @@ -412,7 +412,7 @@ public function crmV3OwnersRequest($after = null, $archived = false, $email = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -728,7 +728,7 @@ public function getByIdRequest($owner_id, $archived = false, $id_property = 'id' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Pipelines/Api/BasicApi.php b/codegen/Crm/Pipelines/Api/BasicApi.php index 7b27a3e9..618f3b2f 100644 --- a/codegen/Crm/Pipelines/Api/BasicApi.php +++ b/codegen/Crm/Pipelines/Api/BasicApi.php @@ -410,7 +410,7 @@ public function archiveRequest($object_type, $pipeline_id, $validate_deal_stage_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -695,7 +695,7 @@ public function archive_0Request($object_type, $pipeline_id, $stage_id, $validat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -979,7 +979,7 @@ public function createRequest($object_type, $pipeline_input, string $contentType if (isset($pipeline_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_input; } @@ -1000,7 +1000,7 @@ public function createRequest($object_type, $pipeline_input, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1304,7 +1304,7 @@ public function create_0Request($object_type, $pipeline_id, $pipeline_stage_inpu if (isset($pipeline_stage_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_input; } @@ -1325,7 +1325,7 @@ public function create_0Request($object_type, $pipeline_id, $pipeline_stage_inpu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1611,7 +1611,7 @@ public function getAllRequest($object_type, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1917,7 +1917,7 @@ public function getAll_0Request($object_type, $pipeline_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2223,7 +2223,7 @@ public function getAuditRequest($object_type, $pipeline_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2544,7 +2544,7 @@ public function getAudit_0Request($object_type, $pipeline_id, $stage_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2850,7 +2850,7 @@ public function getByIdRequest($object_type, $pipeline_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3176,7 +3176,7 @@ public function getById_0Request($object_type, $pipeline_id, $stage_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3510,7 +3510,7 @@ public function replaceRequest($object_type, $pipeline_id, $pipeline_replace_inp if (isset($pipeline_replace_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_replace_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_replace_input; } @@ -3531,7 +3531,7 @@ public function replaceRequest($object_type, $pipeline_id, $pipeline_replace_inp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3855,7 +3855,7 @@ public function replace_0Request($object_type, $pipeline_id, $stage_id, $pipelin if (isset($pipeline_stage_replace_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_replace_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_replace_input; } @@ -3876,7 +3876,7 @@ public function replace_0Request($object_type, $pipeline_id, $stage_id, $pipelin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4202,7 +4202,7 @@ public function updateRequest($object_type, $pipeline_id, $pipeline_patch_input, if (isset($pipeline_patch_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_patch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_patch_input; } @@ -4223,7 +4223,7 @@ public function updateRequest($object_type, $pipeline_id, $pipeline_patch_input, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4539,7 +4539,7 @@ public function update_0Request($object_type, $pipeline_id, $stage_id, $pipeline if (isset($pipeline_stage_patch_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($pipeline_stage_patch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $pipeline_stage_patch_input; } @@ -4560,7 +4560,7 @@ public function update_0Request($object_type, $pipeline_id, $stage_id, $pipeline } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Products/Api/BasicApi.php b/codegen/Crm/Products/Api/BasicApi.php index 8ee1283b..7e0e6f0a 100644 --- a/codegen/Crm/Products/Api/BasicApi.php +++ b/codegen/Crm/Products/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($product_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($product_id, $archived = false, $associations = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($product_id, $simple_public_object_input, $id_prop 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($product_id, $simple_public_object_input, $id_prop } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Products/Api/BatchApi.php b/codegen/Crm/Products/Api/BatchApi.php index 87654f2e..307fb091 100644 --- a/codegen/Crm/Products/Api/BatchApi.php +++ b/codegen/Crm/Products/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Products/Api/SearchApi.php b/codegen/Crm/Products/Api/SearchApi.php index 45aa63fa..20035a9b 100644 --- a/codegen/Crm/Products/Api/SearchApi.php +++ b/codegen/Crm/Products/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/BasicApi.php b/codegen/Crm/Properties/Api/BasicApi.php index cb0378d5..70b85c87 100644 --- a/codegen/Crm/Properties/Api/BasicApi.php +++ b/codegen/Crm/Properties/Api/BasicApi.php @@ -353,7 +353,7 @@ public function archiveRequest($object_type, $group_name, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function createRequest($object_type, $property_group_create, string $cont if (isset($property_group_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_group_create), JSON_THROW_ON_ERROR); } else { $httpBody = $property_group_create; } @@ -658,7 +658,7 @@ public function createRequest($object_type, $property_group_create, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -959,7 +959,7 @@ public function getAllRequest($object_type, $locale = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1280,7 +1280,7 @@ public function getByNameRequest($object_type, $group_name, $locale = null, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1584,7 +1584,7 @@ public function updateRequest($object_type, $group_name, $property_group_update, if (isset($property_group_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_group_update), JSON_THROW_ON_ERROR); } else { $httpBody = $property_group_update; } @@ -1605,7 +1605,7 @@ public function updateRequest($object_type, $group_name, $property_group_update, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/BatchApi.php b/codegen/Crm/Properties/Api/BatchApi.php index 2f3a0fcb..7795a483 100644 --- a/codegen/Crm/Properties/Api/BatchApi.php +++ b/codegen/Crm/Properties/Api/BatchApi.php @@ -325,7 +325,7 @@ public function archiveRequest($object_type, $batch_input_property_name, string if (isset($batch_input_property_name)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_property_name), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_property_name; } @@ -346,7 +346,7 @@ public function archiveRequest($object_type, $batch_input_property_name, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -644,7 +644,7 @@ public function createRequest($object_type, $batch_input_property_create, string if (isset($batch_input_property_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_property_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_property_create; } @@ -665,7 +665,7 @@ public function createRequest($object_type, $batch_input_property_create, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -978,7 +978,7 @@ public function readRequest($object_type, $batch_read_input_property_name, $loca if (isset($batch_read_input_property_name)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_property_name), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_property_name; } @@ -999,7 +999,7 @@ public function readRequest($object_type, $batch_read_input_property_name, $loca } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Properties/Api/CoreApi.php b/codegen/Crm/Properties/Api/CoreApi.php index 3a482f78..7c3c0942 100644 --- a/codegen/Crm/Properties/Api/CoreApi.php +++ b/codegen/Crm/Properties/Api/CoreApi.php @@ -353,7 +353,7 @@ public function archiveRequest($object_type, $property_name, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function createRequest($object_type, $property_create, string $contentTyp if (isset($property_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_create), JSON_THROW_ON_ERROR); } else { $httpBody = $property_create; } @@ -658,7 +658,7 @@ public function createRequest($object_type, $property_create, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1004,7 +1004,7 @@ public function getAllRequest($object_type, $archived = false, $properties = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1370,7 +1370,7 @@ public function getByNameRequest($object_type, $property_name, $archived = false } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1674,7 +1674,7 @@ public function updateRequest($object_type, $property_name, $property_update, st if (isset($property_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($property_update), JSON_THROW_ON_ERROR); } else { $httpBody = $property_update; } @@ -1695,7 +1695,7 @@ public function updateRequest($object_type, $property_name, $property_update, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Quotes/Api/BasicApi.php b/codegen/Crm/Quotes/Api/BasicApi.php index 75d7d993..8a77963c 100644 --- a/codegen/Crm/Quotes/Api/BasicApi.php +++ b/codegen/Crm/Quotes/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($quote_id, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -617,7 +617,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -977,7 +977,7 @@ public function getByIdRequest($quote_id, $archived = false, $associations = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1329,7 +1329,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1627,7 +1627,7 @@ public function updateRequest($quote_id, $simple_public_object_input, $id_proper 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1648,7 +1648,7 @@ public function updateRequest($quote_id, $simple_public_object_input, $id_proper } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Quotes/Api/BatchApi.php b/codegen/Crm/Quotes/Api/BatchApi.php index c766ae61..88e59a3b 100644 --- a/codegen/Crm/Quotes/Api/BatchApi.php +++ b/codegen/Crm/Quotes/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -606,7 +606,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -627,7 +627,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -916,7 +916,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -937,7 +937,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1232,7 +1232,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1506,7 +1506,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1527,7 +1527,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Quotes/Api/SearchApi.php b/codegen/Crm/Quotes/Api/SearchApi.php index 02a626b0..1e59c104 100644 --- a/codegen/Crm/Quotes/Api/SearchApi.php +++ b/codegen/Crm/Quotes/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/AdvancedApi.php b/codegen/Crm/Schemas/Api/AdvancedApi.php index 44da5362..6bbc70b9 100644 --- a/codegen/Crm/Schemas/Api/AdvancedApi.php +++ b/codegen/Crm/Schemas/Api/AdvancedApi.php @@ -375,7 +375,7 @@ public function createAssociationRequest($object_type, $association_definition_e if (isset($association_definition_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($association_definition_egg), JSON_THROW_ON_ERROR); } else { $httpBody = $association_definition_egg; } @@ -396,7 +396,7 @@ public function createAssociationRequest($object_type, $association_definition_e } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/BasicApi.php b/codegen/Crm/Schemas/Api/BasicApi.php index 5f4361f1..23a806e2 100644 --- a/codegen/Crm/Schemas/Api/BasicApi.php +++ b/codegen/Crm/Schemas/Api/BasicApi.php @@ -351,7 +351,7 @@ public function archiveRequest($object_type, $archived = false, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -601,7 +601,7 @@ public function archiveAssociationRequest($association_identifier, $object_type, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -865,7 +865,7 @@ public function createRequest($object_schema_egg, string $contentType = self::co if (isset($object_schema_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_schema_egg), JSON_THROW_ON_ERROR); } else { $httpBody = $object_schema_egg; } @@ -886,7 +886,7 @@ public function createRequest($object_schema_egg, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1212,7 +1212,7 @@ public function getAllRequest($archived = false, $include_association_definition } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1543,7 +1543,7 @@ public function getByIdRequest($object_type, $include_association_definitions = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1827,7 +1827,7 @@ public function updateRequest($object_type, $object_type_definition_patch, strin if (isset($object_type_definition_patch)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_type_definition_patch), JSON_THROW_ON_ERROR); } else { $httpBody = $object_type_definition_patch; } @@ -1848,7 +1848,7 @@ public function updateRequest($object_type, $object_type_definition_patch, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Schemas/Api/BatchApi.php b/codegen/Crm/Schemas/Api/BatchApi.php index e0371c50..14d29071 100644 --- a/codegen/Crm/Schemas/Api/BatchApi.php +++ b/codegen/Crm/Schemas/Api/BatchApi.php @@ -355,7 +355,7 @@ public function crmObjectSchemasV3SchemasBatchReadRequest($object_schema_batch_r if (isset($object_schema_batch_read_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($object_schema_batch_read_request), JSON_THROW_ON_ERROR); } else { $httpBody = $object_schema_batch_read_request; } @@ -376,7 +376,7 @@ public function crmObjectSchemasV3SchemasBatchReadRequest($object_schema_batch_r } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/AdvancedApi.php b/codegen/Crm/Tickets/Api/AdvancedApi.php index a759b1ac..f9393bde 100644 --- a/codegen/Crm/Tickets/Api/AdvancedApi.php +++ b/codegen/Crm/Tickets/Api/AdvancedApi.php @@ -355,7 +355,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co if (isset($public_merge_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input), JSON_THROW_ON_ERROR); } else { $httpBody = $public_merge_input; } @@ -376,7 +376,7 @@ public function mergeRequest($public_merge_input, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/BasicApi.php b/codegen/Crm/Tickets/Api/BasicApi.php index c0a4b551..1ef208a7 100644 --- a/codegen/Crm/Tickets/Api/BasicApi.php +++ b/codegen/Crm/Tickets/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($ticket_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -600,7 +600,7 @@ public function createRequest($simple_public_object_input_for_create, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input_for_create; } @@ -621,7 +621,7 @@ public function createRequest($simple_public_object_input_for_create, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -985,7 +985,7 @@ public function getByIdRequest($ticket_id, $archived = false, $associations = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1341,7 +1341,7 @@ public function getPageRequest($after = null, $archived = false, $associations = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1643,7 +1643,7 @@ public function updateRequest($ticket_id, $simple_public_object_input, $id_prope 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input), JSON_THROW_ON_ERROR); } else { $httpBody = $simple_public_object_input; } @@ -1664,7 +1664,7 @@ public function updateRequest($ticket_id, $simple_public_object_input, $id_prope } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/BatchApi.php b/codegen/Crm/Tickets/Api/BatchApi.php index 13dfcf76..d5267e5c 100644 --- a/codegen/Crm/Tickets/Api/BatchApi.php +++ b/codegen/Crm/Tickets/Api/BatchApi.php @@ -311,7 +311,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -332,7 +332,7 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -610,7 +610,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_for_create; } @@ -631,7 +631,7 @@ public function createRequest($batch_input_simple_public_object_batch_input_for_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -924,7 +924,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -945,7 +945,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1223,7 +1223,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1244,7 +1244,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1522,7 +1522,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_simple_public_object_batch_input_upsert; } @@ -1543,7 +1543,7 @@ public function upsertRequest($batch_input_simple_public_object_batch_input_upse } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Tickets/Api/SearchApi.php b/codegen/Crm/Tickets/Api/SearchApi.php index ae4b4653..43271570 100644 --- a/codegen/Crm/Tickets/Api/SearchApi.php +++ b/codegen/Crm/Tickets/Api/SearchApi.php @@ -355,7 +355,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy if (isset($public_object_search_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request), JSON_THROW_ON_ERROR); } else { $httpBody = $public_object_search_request; } @@ -376,7 +376,7 @@ public function doSearchRequest($public_object_search_request, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Timeline/Api/AdvancedApi.php b/codegen/Crm/Timeline/Api/AdvancedApi.php index 5a655ab3..ad03d8e1 100644 --- a/codegen/Crm/Timeline/Api/AdvancedApi.php +++ b/codegen/Crm/Timeline/Api/AdvancedApi.php @@ -363,7 +363,7 @@ public function createRequest($timeline_event, string $contentType = self::conte if (isset($timeline_event)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event), JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event; } @@ -384,7 +384,7 @@ public function createRequest($timeline_event, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -693,7 +693,7 @@ public function create_0Request($app_id, $event_template_id, $timeline_event_tem if (isset($timeline_event_template_token)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_token), JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_token; } @@ -714,7 +714,7 @@ public function create_0Request($app_id, $event_template_id, $timeline_event_tem } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Timeline/Api/BasicApi.php b/codegen/Crm/Timeline/Api/BasicApi.php index 5370a099..83edbd33 100644 --- a/codegen/Crm/Timeline/Api/BasicApi.php +++ b/codegen/Crm/Timeline/Api/BasicApi.php @@ -367,7 +367,7 @@ public function archiveRequest($app_id, $event_template_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -643,7 +643,7 @@ public function archive_0Request($app_id, $event_template_id, $token_name, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -933,7 +933,7 @@ public function createRequest($app_id, $timeline_event_template_create_request, if (isset($timeline_event_template_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_create_request; } @@ -954,7 +954,7 @@ public function createRequest($app_id, $timeline_event_template_create_request, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1246,7 +1246,7 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1558,7 +1558,7 @@ public function getByIdRequest($event_id, $event_template_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1869,7 +1869,7 @@ public function getById_0Request($app_id, $event_template_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2179,7 +2179,7 @@ public function updateRequest($app_id, $event_template_id, $timeline_event_templ if (isset($timeline_event_template_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_update_request; } @@ -2200,7 +2200,7 @@ public function updateRequest($app_id, $event_template_id, $timeline_event_templ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2530,7 +2530,7 @@ public function update_0Request($app_id, $event_template_id, $token_name, $timel if (isset($timeline_event_template_token_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($timeline_event_template_token_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $timeline_event_template_token_update_request; } @@ -2551,7 +2551,7 @@ public function update_0Request($app_id, $event_template_id, $token_name, $timel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Crm/Timeline/Api/BatchApi.php b/codegen/Crm/Timeline/Api/BatchApi.php index ac2d740b..8c68c2bb 100644 --- a/codegen/Crm/Timeline/Api/BatchApi.php +++ b/codegen/Crm/Timeline/Api/BatchApi.php @@ -374,7 +374,7 @@ public function createBatchRequest($batch_input_timeline_event, string $contentT if (isset($batch_input_timeline_event)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_timeline_event), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_timeline_event; } @@ -395,7 +395,7 @@ public function createBatchRequest($batch_input_timeline_event, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Events/Api/BasicApi.php b/codegen/Events/Api/BasicApi.php index ec6e5908..cb60b02c 100644 --- a/codegen/Events/Api/BasicApi.php +++ b/codegen/Events/Api/BasicApi.php @@ -547,7 +547,7 @@ public function eventsV3EventsRequest($after = null, $before = null, $event_type } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -801,7 +801,7 @@ public function eventsV3EventsEventTypesRequest(string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Events/Send/Api/BasicApi.php b/codegen/Events/Send/Api/BasicApi.php index 02585ec1..c9ada978 100644 --- a/codegen/Events/Send/Api/BasicApi.php +++ b/codegen/Events/Send/Api/BasicApi.php @@ -299,7 +299,7 @@ public function sendRequest($behavioral_event_http_completion_request, string $c if (isset($behavioral_event_http_completion_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($behavioral_event_http_completion_request), JSON_THROW_ON_ERROR); } else { $httpBody = $behavioral_event_http_completion_request; } @@ -320,7 +320,7 @@ public function sendRequest($behavioral_event_http_completion_request, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Events/Send/Api/BatchApi.php b/codegen/Events/Send/Api/BatchApi.php index aa0cd9ee..ff8e05d9 100644 --- a/codegen/Events/Send/Api/BatchApi.php +++ b/codegen/Events/Send/Api/BatchApi.php @@ -299,7 +299,7 @@ public function sendRequest($batched_behavioral_event_http_completion_request, s 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batched_behavioral_event_http_completion_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batched_behavioral_event_http_completion_request; } @@ -320,7 +320,7 @@ public function sendRequest($batched_behavioral_event_http_completion_request, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/BasicApi.php b/codegen/Files/Api/BasicApi.php index fe3e0250..ba393b5c 100644 --- a/codegen/Files/Api/BasicApi.php +++ b/codegen/Files/Api/BasicApi.php @@ -358,7 +358,7 @@ public function filesV3FilesFileIdDownloadRequest($file_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/FilesApi.php b/codegen/Files/Api/FilesApi.php index 24cc93f1..6e4573e2 100644 --- a/codegen/Files/Api/FilesApi.php +++ b/codegen/Files/Api/FilesApi.php @@ -357,7 +357,7 @@ public function archiveRequest($file_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -643,7 +643,7 @@ public function checkImportRequest($task_id, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -907,7 +907,7 @@ public function createRequest($folder_input, string $contentType = self::content if (isset($folder_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($folder_input), JSON_THROW_ON_ERROR); } else { $httpBody = $folder_input; } @@ -928,7 +928,7 @@ public function createRequest($folder_input, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1161,7 +1161,7 @@ public function deleteRequest($file_id, string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1967,7 +1967,7 @@ public function doSearchRequest($after = null, $allows_anonymous_access = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2271,7 +2271,7 @@ public function getByIdRequest($file_id, $properties = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2575,7 +2575,7 @@ public function getMetadataRequest($path, $properties = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2909,7 +2909,7 @@ public function getSignedUrlRequest($file_id, $expiration_seconds = null, $size } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3173,7 +3173,7 @@ public function importFromUrlRequest($import_from_url_input, string $contentType if (isset($import_from_url_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($import_from_url_input), JSON_THROW_ON_ERROR); } else { $httpBody = $import_from_url_input; } @@ -3194,7 +3194,7 @@ public function importFromUrlRequest($import_from_url_input, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3513,7 +3513,7 @@ public function replaceRequest($file_id, $charset_hunch = null, $file = null, $o } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3800,7 +3800,7 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co if (isset($file_update_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($file_update_input), JSON_THROW_ON_ERROR); } else { $httpBody = $file_update_input; } @@ -3821,7 +3821,7 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4138,7 +4138,7 @@ public function uploadRequest($charset_hunch = null, $file = null, $file_name = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Files/Api/FoldersApi.php b/codegen/Files/Api/FoldersApi.php index 5c64dcc1..b28c8ab8 100644 --- a/codegen/Files/Api/FoldersApi.php +++ b/codegen/Files/Api/FoldersApi.php @@ -345,7 +345,7 @@ public function archiveRequest($folder_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -578,7 +578,7 @@ public function archiveByPathRequest($folder_path, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -864,7 +864,7 @@ public function checkUpdateStatusRequest($task_id, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1385,7 +1385,7 @@ public function doSearchRequest($after = null, $before = null, $created_at = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1689,7 +1689,7 @@ public function getByIdRequest($folder_id, $properties = null, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1993,7 +1993,7 @@ public function getByPathRequest($folder_path, $properties = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2280,7 +2280,7 @@ public function updatePropertiesRequest($folder_id, $folder_update_input, string if (isset($folder_update_input)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($folder_update_input), JSON_THROW_ON_ERROR); } else { $httpBody = $folder_update_input; } @@ -2301,7 +2301,7 @@ public function updatePropertiesRequest($folder_id, $folder_update_input, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2565,7 +2565,7 @@ public function updatePropertiesRecursivelyRequest($folder_update_input_with_id, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($folder_update_input_with_id), JSON_THROW_ON_ERROR); } else { $httpBody = $folder_update_input_with_id; } @@ -2586,7 +2586,7 @@ public function updatePropertiesRecursivelyRequest($folder_update_input_with_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Emails/Api/BasicApi.php b/codegen/Marketing/Emails/Api/BasicApi.php index 22efe2a9..97489560 100644 --- a/codegen/Marketing/Emails/Api/BasicApi.php +++ b/codegen/Marketing/Emails/Api/BasicApi.php @@ -426,7 +426,7 @@ public function getEmailsListRequest($email_ids = null, $end_timestamp = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -752,7 +752,7 @@ public function getHistogramRequest($email_ids = null, $end_timestamp = null, $i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1325,7 +1325,7 @@ public function marketingV3EmailsRequest($after = null, $archived = null, $campa } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1581,7 +1581,7 @@ public function marketingV3Emails_0Request($email_create_request, string $conten if (isset($email_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $email_create_request; } @@ -1602,7 +1602,7 @@ public function marketingV3Emails_0Request($email_create_request, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Emails/Api/EmailsApi.php b/codegen/Marketing/Emails/Api/EmailsApi.php index 2a7fc171..0bd95741 100644 --- a/codegen/Marketing/Emails/Api/EmailsApi.php +++ b/codegen/Marketing/Emails/Api/EmailsApi.php @@ -378,7 +378,7 @@ public function archiveRequest($email_id, $archived = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -642,7 +642,7 @@ public function callCloneRequest($email_clone_request_v_next, string $contentTyp if (isset($email_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_clone_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $email_clone_request_v_next; } @@ -663,7 +663,7 @@ public function callCloneRequest($email_clone_request_v_next, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -927,7 +927,7 @@ public function createAbTestVariationRequest($ab_test_create_request_v_next, str if (isset($ab_test_create_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($ab_test_create_request_v_next), JSON_THROW_ON_ERROR); } else { $httpBody = $ab_test_create_request_v_next; } @@ -948,7 +948,7 @@ public function createAbTestVariationRequest($ab_test_create_request_v_next, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1324,7 +1324,7 @@ public function getAbTestVariationRequest($email_id, $archived = null, $included } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1700,7 +1700,7 @@ public function getByIdRequest($email_id, $archived = null, $included_properties } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1986,7 +1986,7 @@ public function getDraftRequest($email_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2292,7 +2292,7 @@ public function getRevisionByIdRequest($email_id, $revision_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2623,7 +2623,7 @@ public function getRevisionsRequest($email_id, $after = null, $before = null, $l } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2853,7 +2853,7 @@ public function publishOrSendRequest($email_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3083,7 +3083,7 @@ public function resetDraftRequest($email_id, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3389,7 +3389,7 @@ public function restoreDraftRevisionRequest($email_id, $revision_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3639,7 +3639,7 @@ public function restoreRevisionRequest($email_id, $revision_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3869,7 +3869,7 @@ public function unpublishOrCancelRequest($email_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4168,7 +4168,7 @@ public function updateRequest($email_id, $email_update_request, $archived = null if (isset($email_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $email_update_request; } @@ -4189,7 +4189,7 @@ public function updateRequest($email_id, $email_update_request, $archived = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4473,7 +4473,7 @@ public function upsertDraftRequest($email_id, $email_update_request, string $con if (isset($email_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($email_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $email_update_request; } @@ -4494,7 +4494,7 @@ public function upsertDraftRequest($email_id, $email_update_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/BasicApi.php b/codegen/Marketing/Events/Api/BasicApi.php index e077c8db..e61bfc96 100644 --- a/codegen/Marketing/Events/Api/BasicApi.php +++ b/codegen/Marketing/Events/Api/BasicApi.php @@ -366,7 +366,7 @@ public function archiveRequest($external_event_id, $external_account_id, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -596,7 +596,7 @@ public function archiveByObjectIdRequest($object_id, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -860,7 +860,7 @@ public function createRequest($marketing_event_create_request_params, string $co 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params), JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_create_request_params; } @@ -881,7 +881,7 @@ public function createRequest($marketing_event_create_request_params, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1167,7 +1167,7 @@ public function getByObjectIdRequest($object_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1474,7 +1474,7 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1762,7 +1762,7 @@ public function marketingMarketingEventsV3Request($after = null, $limit = 10, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2067,7 +2067,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params), JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_update_request_params; } @@ -2088,7 +2088,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2372,7 +2372,7 @@ public function updateByObjectIdRequest($object_id, $marketing_event_public_upda 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_public_update_request_v2), JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_public_update_request_v2; } @@ -2393,7 +2393,7 @@ public function updateByObjectIdRequest($object_id, $marketing_event_public_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2677,7 +2677,7 @@ public function upsertRequest($external_event_id, $marketing_event_create_reques 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params), JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_create_request_params; } @@ -2698,7 +2698,7 @@ public function upsertRequest($external_event_id, $marketing_event_create_reques } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/BatchApi.php b/codegen/Marketing/Events/Api/BatchApi.php index f1862f2f..a83f471e 100644 --- a/codegen/Marketing/Events/Api/BatchApi.php +++ b/codegen/Marketing/Events/Api/BatchApi.php @@ -350,7 +350,7 @@ public function archiveRequest($batch_input_marketing_event_external_unique_iden 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_external_unique_identifier; } @@ -371,7 +371,7 @@ public function archiveRequest($batch_input_marketing_event_external_unique_iden } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -621,7 +621,7 @@ public function archiveByObjectIdRequest($batch_input_marketing_event_public_obj 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_object_id_delete_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_public_object_id_delete_request; } @@ -642,7 +642,7 @@ public function archiveByObjectIdRequest($batch_input_marketing_event_public_obj } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -920,7 +920,7 @@ public function updateByObjectIdRequest($batch_input_marketing_event_public_upda 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_update_request_full_v2), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_public_update_request_full_v2; } @@ -941,7 +941,7 @@ public function updateByObjectIdRequest($batch_input_marketing_event_public_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1205,7 +1205,7 @@ public function upsertRequest($batch_input_marketing_event_create_request_params 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_create_request_params; } @@ -1226,7 +1226,7 @@ public function upsertRequest($batch_input_marketing_event_create_request_params } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/EventAttendeesApi.php b/codegen/Marketing/Events/Api/EventAttendeesApi.php index 63f1195a..b6a8ef8a 100644 --- a/codegen/Marketing/Events/Api/EventAttendeesApi.php +++ b/codegen/Marketing/Events/Api/EventAttendeesApi.php @@ -419,7 +419,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -440,7 +440,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -744,7 +744,7 @@ public function recordByContactIdRequest($object_id, $subscriber_state, $batch_i 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -765,7 +765,7 @@ public function recordByContactIdRequest($object_id, $subscriber_state, $batch_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1084,7 +1084,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -1105,7 +1105,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1409,7 +1409,7 @@ public function recordByEmailRequest($object_id, $subscriber_state, $batch_input 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -1430,7 +1430,7 @@ public function recordByEmailRequest($object_id, $subscriber_state, $batch_input } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/EventStatusApi.php b/codegen/Marketing/Events/Api/EventStatusApi.php index c4c5eca5..e760979d 100644 --- a/codegen/Marketing/Events/Api/EventStatusApi.php +++ b/codegen/Marketing/Events/Api/EventStatusApi.php @@ -401,7 +401,7 @@ public function cancelRequest($external_event_id, $external_account_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -706,7 +706,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params), JSON_THROW_ON_ERROR); } else { $httpBody = $marketing_event_complete_request_params; } @@ -727,7 +727,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/IdentifiersApi.php b/codegen/Marketing/Events/Api/IdentifiersApi.php index 4f84e524..6a35b6a7 100644 --- a/codegen/Marketing/Events/Api/IdentifiersApi.php +++ b/codegen/Marketing/Events/Api/IdentifiersApi.php @@ -381,7 +381,7 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -667,7 +667,7 @@ public function searchPortalEventsRequest($external_event_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/ListAssociationsApi.php b/codegen/Marketing/Events/Api/ListAssociationsApi.php index 0dd1ecda..d0a6ecf2 100644 --- a/codegen/Marketing/Events/Api/ListAssociationsApi.php +++ b/codegen/Marketing/Events/Api/ListAssociationsApi.php @@ -376,7 +376,7 @@ public function associateByExternalAccountAndEventIdsRequest($external_account_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -626,7 +626,7 @@ public function associateByMarketingEventIdRequest($list_id, $marketing_event_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -896,7 +896,7 @@ public function disassociateByExternalAccountAndEventIdsRequest($external_accoun } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1146,7 +1146,7 @@ public function disassociateByMarketingEventIdRequest($list_id, $marketing_event } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1452,7 +1452,7 @@ public function getAllByExternalAccountAndEventIdsRequest($external_account_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1738,7 +1738,7 @@ public function getAllByMarketingEventIdRequest($marketing_event_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/ParticipantStateApi.php b/codegen/Marketing/Events/Api/ParticipantStateApi.php index 76ada785..be205bd2 100644 --- a/codegen/Marketing/Events/Api/ParticipantStateApi.php +++ b/codegen/Marketing/Events/Api/ParticipantStateApi.php @@ -434,7 +434,7 @@ public function getParticipationsBreakdownByContactIdRequest($contact_identifier } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -800,7 +800,7 @@ public function getParticipationsBreakdownByExternalEventIdRequest($external_acc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1146,7 +1146,7 @@ public function getParticipationsBreakdownByMarketingEventIdRequest($marketing_e } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1452,7 +1452,7 @@ public function getParticipationsCountersByEventExternalIdRequest($external_acco } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1738,7 +1738,7 @@ public function getParticipationsCountersByMarketingEventIdRequest($marketing_ev } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/SettingsApi.php b/codegen/Marketing/Events/Api/SettingsApi.php index 89198f44..7e317e7c 100644 --- a/codegen/Marketing/Events/Api/SettingsApi.php +++ b/codegen/Marketing/Events/Api/SettingsApi.php @@ -380,7 +380,7 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -665,7 +665,7 @@ public function updateRequest($app_id, $event_detail_settings_url, string $conte if (isset($event_detail_settings_url)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($event_detail_settings_url), JSON_THROW_ON_ERROR); } else { $httpBody = $event_detail_settings_url; } @@ -686,7 +686,7 @@ public function updateRequest($app_id, $event_detail_settings_url, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php index c925a46d..fc822659 100644 --- a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php @@ -405,7 +405,7 @@ public function upsertByContactEmailRequest($external_event_id, $subscriber_stat 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_email_subscriber; } @@ -426,7 +426,7 @@ public function upsertByContactEmailRequest($external_event_id, $subscriber_stat } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -737,7 +737,7 @@ public function upsertByContactIdRequest($external_event_id, $subscriber_state, 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 = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_marketing_event_subscriber; } @@ -758,7 +758,7 @@ public function upsertByContactIdRequest($external_event_id, $subscriber_state, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Forms/Api/BasicApi.php b/codegen/Marketing/Forms/Api/BasicApi.php index 431582f6..61997c4e 100644 --- a/codegen/Marketing/Forms/Api/BasicApi.php +++ b/codegen/Marketing/Forms/Api/BasicApi.php @@ -336,7 +336,7 @@ public function archiveRequest($form_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -637,7 +637,7 @@ public function getByIdRequest($form_id, $archived = null, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -955,7 +955,7 @@ public function marketingV3FormsRequest($after = null, $archived = null, $form_t } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1211,7 +1211,7 @@ public function marketingV3Forms_0Request($body, string $contentType = self::con if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); } else { $httpBody = $body; } @@ -1232,7 +1232,7 @@ public function marketingV3Forms_0Request($body, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1516,7 +1516,7 @@ public function replaceRequest($form_id, $hub_spot_form_definition, string $cont if (isset($hub_spot_form_definition)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_spot_form_definition), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_spot_form_definition; } @@ -1537,7 +1537,7 @@ public function replaceRequest($form_id, $hub_spot_form_definition, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1821,7 +1821,7 @@ public function updateRequest($form_id, $hub_spot_form_definition_patch_request, if (isset($hub_spot_form_definition_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($hub_spot_form_definition_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $hub_spot_form_definition_patch_request; } @@ -1842,7 +1842,7 @@ public function updateRequest($form_id, $hub_spot_form_definition_patch_request, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Transactional/Api/SMTPTokensApi.php b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php index e2d9a7da..5fa8298c 100644 --- a/codegen/Marketing/Transactional/Api/SMTPTokensApi.php +++ b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php @@ -333,7 +333,7 @@ public function archiveTokenRequest($token_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -597,7 +597,7 @@ public function createTokenRequest($smtp_api_token_request_egg, string $contentT if (isset($smtp_api_token_request_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($smtp_api_token_request_egg), JSON_THROW_ON_ERROR); } else { $httpBody = $smtp_api_token_request_egg; } @@ -618,7 +618,7 @@ public function createTokenRequest($smtp_api_token_request_egg, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -904,7 +904,7 @@ public function getTokenByIdRequest($token_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1230,7 +1230,7 @@ public function getTokensPageRequest($after = null, $campaign_name = null, $emai } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1516,7 +1516,7 @@ public function resetPasswordRequest($token_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php index 1ba2b7c3..36fb66d6 100644 --- a/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php +++ b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php @@ -355,7 +355,7 @@ public function sendEmailRequest($public_single_send_request_egg, string $conten if (isset($public_single_send_request_egg)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_single_send_request_egg), JSON_THROW_ON_ERROR); } else { $httpBody = $public_single_send_request_egg; } @@ -376,7 +376,7 @@ public function sendEmailRequest($public_single_send_request_egg, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/AccessTokensApi.php b/codegen/Oauth/Api/AccessTokensApi.php index 6e67c6b8..7aac0e57 100644 --- a/codegen/Oauth/Api/AccessTokensApi.php +++ b/codegen/Oauth/Api/AccessTokensApi.php @@ -374,7 +374,7 @@ public function getRequest($token, string $contentType = self::contentTypes['get } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/RefreshTokensApi.php b/codegen/Oauth/Api/RefreshTokensApi.php index ec914b14..fd313cd0 100644 --- a/codegen/Oauth/Api/RefreshTokensApi.php +++ b/codegen/Oauth/Api/RefreshTokensApi.php @@ -321,7 +321,7 @@ public function archiveRequest($token, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -600,7 +600,7 @@ public function getRequest($token, string $contentType = self::contentTypes['get } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Oauth/Api/TokensApi.php b/codegen/Oauth/Api/TokensApi.php index bbd17e8d..56d4f21b 100644 --- a/codegen/Oauth/Api/TokensApi.php +++ b/codegen/Oauth/Api/TokensApi.php @@ -421,7 +421,7 @@ public function createRequest($grant_type = null, $code = null, $redirect_uri = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/BusinessUnits/Api/BasicApi.php b/codegen/Settings/BusinessUnits/Api/BasicApi.php index 053a6780..ac78ab2a 100644 --- a/codegen/Settings/BusinessUnits/Api/BasicApi.php +++ b/codegen/Settings/BusinessUnits/Api/BasicApi.php @@ -407,7 +407,7 @@ public function getByUserIDRequest($user_id, $name = null, $properties = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/BasicApi.php b/codegen/Settings/Users/Api/BasicApi.php index 719113b9..e8589053 100644 --- a/codegen/Settings/Users/Api/BasicApi.php +++ b/codegen/Settings/Users/Api/BasicApi.php @@ -382,7 +382,7 @@ public function settingsUsersV3Request($after = null, $limit = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -638,7 +638,7 @@ public function settingsUsersV3_0Request($user_provision_request, string $conten if (isset($user_provision_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($user_provision_request), JSON_THROW_ON_ERROR); } else { $httpBody = $user_provision_request; } @@ -659,7 +659,7 @@ public function settingsUsersV3_0Request($user_provision_request, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/RolesApi.php b/codegen/Settings/Users/Api/RolesApi.php index 0725a7e9..ffec8de7 100644 --- a/codegen/Settings/Users/Api/RolesApi.php +++ b/codegen/Settings/Users/Api/RolesApi.php @@ -357,7 +357,7 @@ public function getAllRequest(string $contentType = self::contentTypes['getAll'] } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/TeamsApi.php b/codegen/Settings/Users/Api/TeamsApi.php index 20116b31..cdcf51dc 100644 --- a/codegen/Settings/Users/Api/TeamsApi.php +++ b/codegen/Settings/Users/Api/TeamsApi.php @@ -357,7 +357,7 @@ public function getAllRequest(string $contentType = self::contentTypes['getAll'] } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Settings/Users/Api/UsersApi.php b/codegen/Settings/Users/Api/UsersApi.php index e16e1854..53b49de5 100644 --- a/codegen/Settings/Users/Api/UsersApi.php +++ b/codegen/Settings/Users/Api/UsersApi.php @@ -342,7 +342,7 @@ public function archiveRequest($user_id, $id_property = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -643,7 +643,7 @@ public function getByIdRequest($user_id, $id_property = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -942,7 +942,7 @@ public function updateRequest($user_id, $public_user_update, $id_property = null if (isset($public_user_update)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($public_user_update), JSON_THROW_ON_ERROR); } else { $httpBody = $public_user_update; } @@ -963,7 +963,7 @@ public function updateRequest($user_id, $public_user_update, $id_property = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Webhooks/Api/BasicApi.php b/codegen/Webhooks/Api/BasicApi.php index c89ca460..9fde87fb 100644 --- a/codegen/Webhooks/Api/BasicApi.php +++ b/codegen/Webhooks/Api/BasicApi.php @@ -362,7 +362,7 @@ public function archiveRequest($app_id, $subscription_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -593,7 +593,7 @@ public function clearRequest($app_id, string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -878,7 +878,7 @@ public function configureRequest($app_id, $settings_change_request, string $cont if (isset($settings_change_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($settings_change_request), JSON_THROW_ON_ERROR); } else { $httpBody = $settings_change_request; } @@ -899,7 +899,7 @@ public function configureRequest($app_id, $settings_change_request, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1184,7 +1184,7 @@ public function createRequest($app_id, $subscription_create_request, string $con if (isset($subscription_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($subscription_create_request), JSON_THROW_ON_ERROR); } else { $httpBody = $subscription_create_request; } @@ -1205,7 +1205,7 @@ public function createRequest($app_id, $subscription_create_request, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1492,7 +1492,7 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1779,7 +1779,7 @@ public function getAll_0Request($app_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2086,7 +2086,7 @@ public function getByIdRequest($app_id, $subscription_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2391,7 +2391,7 @@ public function updateRequest($app_id, $subscription_id, $subscription_patch_req if (isset($subscription_patch_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($subscription_patch_request), JSON_THROW_ON_ERROR); } else { $httpBody = $subscription_patch_request; } @@ -2412,7 +2412,7 @@ public function updateRequest($app_id, $subscription_id, $subscription_patch_req } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/codegen/Webhooks/Api/BatchApi.php b/codegen/Webhooks/Api/BatchApi.php index 5fba659b..7863b4d1 100644 --- a/codegen/Webhooks/Api/BatchApi.php +++ b/codegen/Webhooks/Api/BatchApi.php @@ -389,7 +389,7 @@ public function updateBatchRequest($app_id, $batch_input_subscription_batch_upda if (isset($batch_input_subscription_batch_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_subscription_batch_update_request), JSON_THROW_ON_ERROR); } else { $httpBody = $batch_input_subscription_batch_update_request; } @@ -410,7 +410,7 @@ public function updateBatchRequest($app_id, $batch_input_subscription_batch_upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = json_encode($1, JSON_THROW_ON_ERROR); + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); From 6c3f75c963405561cab63d2efe07bea718065162 Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Tue, 22 Sep 2026 14:42:54 -0400 Subject: [PATCH 3/5] Update Discovery @method annotations and specs for renamed/pruned API classes Repoints 25 Discovery classes and their PHPSpec tests to match the API class renames and removals from the codegen regen (orphan pruning + Custom Objects registry fix). Old names like CardsApi, CoreApi, SettingsApi, etc. are replaced with BasicApi/AdvancedApi/BatchApi per the new generator output. Co-Authored-By: Claude Sonnet 4.6 --- lib/Discovery/Cms/AuditLogs/Discovery.php | 4 ++-- lib/Discovery/Cms/Blogs/Authors/Discovery.php | 4 ++-- lib/Discovery/Cms/Blogs/Tags/Discovery.php | 4 ++-- lib/Discovery/Cms/Domains/Discovery.php | 4 ++-- lib/Discovery/Cms/SiteSearch/Discovery.php | 4 ++-- lib/Discovery/Cms/SourceCode/Discovery.php | 12 ++++------ lib/Discovery/Cms/UrlRedirects/Discovery.php | 4 ++-- .../CommunicationPreferences/Discovery.php | 8 +++---- .../VisitorIdentification/Discovery.php | 8 +++---- .../Crm/Associations/Schema/Discovery.php | 4 ++-- .../Crm/Associations/V4/Schema/Discovery.php | 8 +++---- lib/Discovery/Crm/Exports/Discovery.php | 6 +++-- .../Crm/Extensions/Calling/Discovery.php | 12 +++++----- .../Crm/Extensions/Cards/Discovery.php | 8 +++---- .../Videoconferencing/Discovery.php | 4 ++-- lib/Discovery/Crm/Imports/Discovery.php | 8 +++---- lib/Discovery/Crm/Owners/Discovery.php | 24 +++---------------- lib/Discovery/Crm/Pipelines/Discovery.php | 10 ++------ lib/Discovery/Crm/Properties/Discovery.php | 6 ++--- lib/Discovery/Crm/Schemas/Discovery.php | 8 +++++-- lib/Discovery/Crm/Timeline/Discovery.php | 12 +++++----- lib/Discovery/Events/Discovery.php | 4 ++-- lib/Discovery/Marketing/Forms/Discovery.php | 4 ++-- .../Settings/BusinessUnits/Discovery.php | 4 ++-- lib/Discovery/Webhooks/Discovery.php | 8 +++---- .../Discovery/Cms/AuditLogs/DiscoverySpec.php | 4 ++-- .../Cms/Blogs/Authors/DiscoverySpec.php | 4 ++-- .../Cms/Blogs/Tags/DiscoverySpec.php | 4 ++-- .../Discovery/Cms/Domains/DiscoverySpec.php | 4 ++-- .../Cms/SiteSearch/DiscoverySpec.php | 4 ++-- .../Cms/SourceCode/DiscoverySpec.php | 12 ++++------ .../Cms/UrlRedirects/DiscoverySpec.php | 4 ++-- .../DiscoverySpec.php | 8 +++---- .../VisitorIdentification/DiscoverySpec.php | 4 ++-- .../Crm/Associations/Schema/DiscoverySpec.php | 4 ++-- .../Associations/V4/Schema/DiscoverySpec.php | 8 +++---- .../Discovery/Crm/Exports/DiscoverySpec.php | 6 +++-- .../Crm/Extensions/Calling/DiscoverySpec.php | 12 +++++----- .../Crm/Extensions/Cards/DiscoverySpec.php | 8 +++---- .../Videoconferencing/DiscoverySpec.php | 4 ++-- .../Discovery/Crm/Imports/DiscoverySpec.php | 8 +++---- .../Discovery/Crm/Owners/DiscoverySpec.php | 4 ++-- .../Discovery/Crm/Pipelines/DiscoverySpec.php | 10 ++------ .../Crm/Properties/DiscoverySpec.php | 2 -- .../Discovery/Crm/Schemas/DiscoverySpec.php | 8 +++++-- .../Discovery/Crm/Timeline/DiscoverySpec.php | 12 +++++----- tests/spec/Discovery/Events/DiscoverySpec.php | 7 +++--- .../Marketing/Forms/DiscoverySpec.php | 4 ++-- .../Settings/BusinessUnits/DiscoverySpec.php | 4 ++-- .../spec/Discovery/Webhooks/DiscoverySpec.php | 8 +++---- 50 files changed, 155 insertions(+), 184 deletions(-) diff --git a/lib/Discovery/Cms/AuditLogs/Discovery.php b/lib/Discovery/Cms/AuditLogs/Discovery.php index c552adac..e78aad89 100644 --- a/lib/Discovery/Cms/AuditLogs/Discovery.php +++ b/lib/Discovery/Cms/AuditLogs/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\AuditLogs; -use HubSpot\Client\Cms\AuditLogs\Api\AuditLogsApi; +use HubSpot\Client\Cms\AuditLogs\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method AuditLogsApi auditLogsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/Blogs/Authors/Discovery.php b/lib/Discovery/Cms/Blogs/Authors/Discovery.php index dbb507ed..9a26a0b0 100644 --- a/lib/Discovery/Cms/Blogs/Authors/Discovery.php +++ b/lib/Discovery/Cms/Blogs/Authors/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\Blogs\Authors; -use HubSpot\Client\Cms\Blogs\Authors\Api\BlogAuthorsApi; +use HubSpot\Client\Cms\Blogs\Authors\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method BlogAuthorsApi blogAuthorsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/Blogs/Tags/Discovery.php b/lib/Discovery/Cms/Blogs/Tags/Discovery.php index 6d5ff90b..474c01cd 100644 --- a/lib/Discovery/Cms/Blogs/Tags/Discovery.php +++ b/lib/Discovery/Cms/Blogs/Tags/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\Blogs\Tags; -use HubSpot\Client\Cms\Blogs\Tags\Api\BlogTagsApi; +use HubSpot\Client\Cms\Blogs\Tags\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method BlogTagsApi blogTagsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/Domains/Discovery.php b/lib/Discovery/Cms/Domains/Discovery.php index f3da7e5e..b35f1768 100644 --- a/lib/Discovery/Cms/Domains/Discovery.php +++ b/lib/Discovery/Cms/Domains/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\Domains; -use HubSpot\Client\Cms\Domains\Api\DomainsApi; +use HubSpot\Client\Cms\Domains\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method DomainsApi domainsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/SiteSearch/Discovery.php b/lib/Discovery/Cms/SiteSearch/Discovery.php index f8bdda0c..a9614059 100644 --- a/lib/Discovery/Cms/SiteSearch/Discovery.php +++ b/lib/Discovery/Cms/SiteSearch/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\SiteSearch; -use HubSpot\Client\Cms\SiteSearch\Api\PublicApi; +use HubSpot\Client\Cms\SiteSearch\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method PublicApi publicApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/SourceCode/Discovery.php b/lib/Discovery/Cms/SourceCode/Discovery.php index a808d7c8..d018d791 100644 --- a/lib/Discovery/Cms/SourceCode/Discovery.php +++ b/lib/Discovery/Cms/SourceCode/Discovery.php @@ -2,16 +2,12 @@ namespace HubSpot\Discovery\Cms\SourceCode; -use HubSpot\Client\Cms\SourceCode\Api\ContentApi; -use HubSpot\Client\Cms\SourceCode\Api\ExtractApi; -use HubSpot\Client\Cms\SourceCode\Api\MetadataApi; -use HubSpot\Client\Cms\SourceCode\Api\ValidationApi; +use HubSpot\Client\Cms\SourceCode\Api\AdvancedApi; +use HubSpot\Client\Cms\SourceCode\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method ContentApi contentApi() - * @method ExtractApi extractApi() - * @method MetadataApi metadataApi() - * @method ValidationApi validationApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/UrlRedirects/Discovery.php b/lib/Discovery/Cms/UrlRedirects/Discovery.php index 8a5758ef..47d7ff25 100644 --- a/lib/Discovery/Cms/UrlRedirects/Discovery.php +++ b/lib/Discovery/Cms/UrlRedirects/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Cms\UrlRedirects; -use HubSpot\Client\Cms\UrlRedirects\Api\RedirectsApi; +use HubSpot\Client\Cms\UrlRedirects\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method RedirectsApi redirectsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/CommunicationPreferences/Discovery.php b/lib/Discovery/CommunicationPreferences/Discovery.php index d7d3845a..1af7ea38 100644 --- a/lib/Discovery/CommunicationPreferences/Discovery.php +++ b/lib/Discovery/CommunicationPreferences/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\CommunicationPreferences; -use HubSpot\Client\CommunicationPreferences\Api\DefinitionsApi; -use HubSpot\Client\CommunicationPreferences\Api\StatusApi; +use HubSpot\Client\CommunicationPreferences\Api\AdvancedApi; +use HubSpot\Client\CommunicationPreferences\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method DefinitionsApi definitionsApi() - * @method StatusApi statusApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Conversations/VisitorIdentification/Discovery.php b/lib/Discovery/Conversations/VisitorIdentification/Discovery.php index f2682f12..bdfeca04 100644 --- a/lib/Discovery/Conversations/VisitorIdentification/Discovery.php +++ b/lib/Discovery/Conversations/VisitorIdentification/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Conversations\VisitorIdentification; -use HubSpot\Client\Conversations\VisitorIdentification\Api\GenerateApi; -use HubSpot\Discovery\Crm\ObjectDiscovery; +use HubSpot\Client\Conversations\VisitorIdentification\Api\BasicApi; +use HubSpot\Discovery\DiscoveryBase; /** - * @method GenerateApi generateApi() + * @method BasicApi basicApi() */ -class Discovery extends ObjectDiscovery {} +class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Associations/Schema/Discovery.php b/lib/Discovery/Crm/Associations/Schema/Discovery.php index bc9ad937..62fc0c1e 100644 --- a/lib/Discovery/Crm/Associations/Schema/Discovery.php +++ b/lib/Discovery/Crm/Associations/Schema/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Crm\Associations\Schema; -use HubSpot\Client\Crm\Associations\Schema\Api\TypesApi; +use HubSpot\Client\Crm\Associations\Schema\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method TypesApi typesApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Associations/V4/Schema/Discovery.php b/lib/Discovery/Crm/Associations/V4/Schema/Discovery.php index be755562..610b90f2 100644 --- a/lib/Discovery/Crm/Associations/V4/Schema/Discovery.php +++ b/lib/Discovery/Crm/Associations/V4/Schema/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\Crm\Associations\V4\Schema; -use HubSpot\Client\Crm\Associations\V4\Schema\Api\DefinitionConfigurationsApi; -use HubSpot\Client\Crm\Associations\V4\Schema\Api\DefinitionsApi; +use HubSpot\Client\Crm\Associations\V4\Schema\Api\LabelsApi; +use HubSpot\Client\Crm\Associations\V4\Schema\Api\LimitsApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method DefinitionsApi definitionsApi() - * @method DefinitionConfigurationsApi definitionConfigurationsApi() + * @method LabelsApi labelsApi() + * @method LimitsApi limitsApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Exports/Discovery.php b/lib/Discovery/Crm/Exports/Discovery.php index bcfd38bf..4dc94a9e 100644 --- a/lib/Discovery/Crm/Exports/Discovery.php +++ b/lib/Discovery/Crm/Exports/Discovery.php @@ -2,10 +2,12 @@ namespace HubSpot\Discovery\Crm\Exports; -use HubSpot\Client\Crm\Exports\Api\PublicExportsApi; +use HubSpot\Client\Crm\Exports\Api\AdvancedApi; +use HubSpot\Client\Crm\Exports\Api\BasicApi; use HubSpot\Discovery\Crm\ObjectDiscovery; /** - * @method PublicExportsApi publicExportsApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() */ class Discovery extends ObjectDiscovery {} diff --git a/lib/Discovery/Crm/Extensions/Calling/Discovery.php b/lib/Discovery/Crm/Extensions/Calling/Discovery.php index 553d6432..f59c6098 100644 --- a/lib/Discovery/Crm/Extensions/Calling/Discovery.php +++ b/lib/Discovery/Crm/Extensions/Calling/Discovery.php @@ -2,14 +2,14 @@ namespace HubSpot\Discovery\Crm\Extensions\Calling; -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\Client\Crm\Extensions\Calling\Api\AdvancedApi; +use HubSpot\Client\Crm\Extensions\Calling\Api\BasicApi; +use HubSpot\Client\Crm\Extensions\Calling\Api\BatchApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method ChannelConnectionSettingsApi channelConnectionSettingsApi() - * @method RecordingSettingsApi recordingSettingsApi() - * @method SettingsApi settingsApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() + * @method BatchApi batchApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Extensions/Cards/Discovery.php b/lib/Discovery/Crm/Extensions/Cards/Discovery.php index 5ae0bb8e..a21f05ff 100644 --- a/lib/Discovery/Crm/Extensions/Cards/Discovery.php +++ b/lib/Discovery/Crm/Extensions/Cards/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\Crm\Extensions\Cards; -use HubSpot\Client\Crm\Extensions\Cards\Api\CardsApi; -use HubSpot\Client\Crm\Extensions\Cards\Api\SampleResponseApi; +use HubSpot\Client\Crm\Extensions\Cards\Api\AdvancedApi; +use HubSpot\Client\Crm\Extensions\Cards\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method CardsApi cardsApi() - * @method SampleResponseApi sampleResponseApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Extensions/Videoconferencing/Discovery.php b/lib/Discovery/Crm/Extensions/Videoconferencing/Discovery.php index ece2de1b..b7f559d4 100644 --- a/lib/Discovery/Crm/Extensions/Videoconferencing/Discovery.php +++ b/lib/Discovery/Crm/Extensions/Videoconferencing/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Crm\Extensions\Videoconferencing; -use HubSpot\Client\Crm\Extensions\Videoconferencing\Api\SettingsApi; +use HubSpot\Client\Crm\Extensions\Videoconferencing\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method SettingsApi settingsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Imports/Discovery.php b/lib/Discovery/Crm/Imports/Discovery.php index 919c9128..b74f3804 100644 --- a/lib/Discovery/Crm/Imports/Discovery.php +++ b/lib/Discovery/Crm/Imports/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\Crm\Imports; -use HubSpot\Client\Crm\Imports\Api\CoreApi; -use HubSpot\Client\Crm\Imports\Api\PublicImportsApi; +use HubSpot\Client\Crm\Imports\Api\AdvancedApi; +use HubSpot\Client\Crm\Imports\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method CoreApi coreApi() - * @method PublicImportsApi publicImportsApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Owners/Discovery.php b/lib/Discovery/Crm/Owners/Discovery.php index 67f0d813..9bba3d1d 100644 --- a/lib/Discovery/Crm/Owners/Discovery.php +++ b/lib/Discovery/Crm/Owners/Discovery.php @@ -2,28 +2,10 @@ namespace HubSpot\Discovery\Crm\Owners; -use HubSpot\Client\Crm\Owners\Api\OwnersApi; +use HubSpot\Client\Crm\Owners\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method OwnersApi ownersApi() + * @method BasicApi basicApi() */ -class Discovery extends DiscoveryBase -{ - public function getAll(?string $email = null, ?string $after = null, bool $archived = false): array - { - $owners = []; - - do { - $page = $this->OwnersApi()->getPage($email, $after, 100, $archived); - - $owners = array_merge($owners, $page->getResults()); - - if (!is_null($page->getPaging())) { - $after = $page->getPaging()->getNext()->getAfter(); - } - } while (is_object($page) && $page->getPaging()); - - return $owners; - } -} +class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Pipelines/Discovery.php b/lib/Discovery/Crm/Pipelines/Discovery.php index c2d809a2..69e84960 100644 --- a/lib/Discovery/Crm/Pipelines/Discovery.php +++ b/lib/Discovery/Crm/Pipelines/Discovery.php @@ -2,16 +2,10 @@ namespace HubSpot\Discovery\Crm\Pipelines; -use HubSpot\Client\Crm\Pipelines\Api\PipelineAuditsApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelineStageAuditsApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelineStagesApi; +use HubSpot\Client\Crm\Pipelines\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method PipelineAuditsApi pipelineAuditsApi() - * @method PipelinesApi pipelinesApi() - * @method PipelineStageAuditsApi pipelineStageAuditsApi() - * @method PipelineStagesApi pipelineStagesApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Properties/Discovery.php b/lib/Discovery/Crm/Properties/Discovery.php index ba5b9515..17a35c6a 100644 --- a/lib/Discovery/Crm/Properties/Discovery.php +++ b/lib/Discovery/Crm/Properties/Discovery.php @@ -4,12 +4,10 @@ use HubSpot\Client\Crm\Properties\Api\BatchApi; use HubSpot\Client\Crm\Properties\Api\CoreApi; -use HubSpot\Client\Crm\Properties\Api\GroupsApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method BatchApi batchApi() - * @method CoreApi coreApi() - * @method GroupsApi groupsApi() + * @method BatchApi batchApi() + * @method CoreApi coreApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Schemas/Discovery.php b/lib/Discovery/Crm/Schemas/Discovery.php index 4bb12115..07cbeda3 100644 --- a/lib/Discovery/Crm/Schemas/Discovery.php +++ b/lib/Discovery/Crm/Schemas/Discovery.php @@ -2,10 +2,14 @@ namespace HubSpot\Discovery\Crm\Schemas; -use HubSpot\Client\Crm\Schemas\Api\CoreApi; +use HubSpot\Client\Crm\Schemas\Api\AdvancedApi; +use HubSpot\Client\Crm\Schemas\Api\BasicApi; +use HubSpot\Client\Crm\Schemas\Api\BatchApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method CoreApi coreApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() + * @method BatchApi batchApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Timeline/Discovery.php b/lib/Discovery/Crm/Timeline/Discovery.php index 8809f3d2..78d78aec 100644 --- a/lib/Discovery/Crm/Timeline/Discovery.php +++ b/lib/Discovery/Crm/Timeline/Discovery.php @@ -2,14 +2,14 @@ namespace HubSpot\Discovery\Crm\Timeline; -use HubSpot\Client\Crm\Timeline\Api\EventsApi; -use HubSpot\Client\Crm\Timeline\Api\TemplatesApi; -use HubSpot\Client\Crm\Timeline\Api\TokensApi; +use HubSpot\Client\Crm\Timeline\Api\AdvancedApi; +use HubSpot\Client\Crm\Timeline\Api\BasicApi; +use HubSpot\Client\Crm\Timeline\Api\BatchApi; use HubSpot\Discovery\Crm\ObjectDiscovery; /** - * @method EventsApi eventsApi() - * @method TemplatesApi templatesApi() - * @method TokensApi tokensApi() + * @method BasicApi basicApi() + * @method AdvancedApi advancedApi() + * @method BatchApi batchApi() */ class Discovery extends ObjectDiscovery {} diff --git a/lib/Discovery/Events/Discovery.php b/lib/Discovery/Events/Discovery.php index e6367ea0..a27e5288 100644 --- a/lib/Discovery/Events/Discovery.php +++ b/lib/Discovery/Events/Discovery.php @@ -2,11 +2,11 @@ namespace HubSpot\Discovery\Events; -use HubSpot\Client\Events\Api\EventsApi; +use HubSpot\Client\Events\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method EventsApi eventsApi() + * @method BasicApi basicApi() * @method Send\Discovery send() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Marketing/Forms/Discovery.php b/lib/Discovery/Marketing/Forms/Discovery.php index ee0aaeae..3c64367a 100644 --- a/lib/Discovery/Marketing/Forms/Discovery.php +++ b/lib/Discovery/Marketing/Forms/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Marketing\Forms; -use HubSpot\Client\Marketing\Forms\Api\FormsApi; +use HubSpot\Client\Marketing\Forms\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method FormsApi formsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Settings/BusinessUnits/Discovery.php b/lib/Discovery/Settings/BusinessUnits/Discovery.php index 84eba627..1f64e148 100644 --- a/lib/Discovery/Settings/BusinessUnits/Discovery.php +++ b/lib/Discovery/Settings/BusinessUnits/Discovery.php @@ -2,10 +2,10 @@ namespace HubSpot\Discovery\Settings\BusinessUnits; -use HubSpot\Client\Settings\BusinessUnits\Api\BusinessUnitsApi; +use HubSpot\Client\Settings\BusinessUnits\Api\BasicApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method BusinessUnitsApi businessUnitsApi() + * @method BasicApi basicApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Webhooks/Discovery.php b/lib/Discovery/Webhooks/Discovery.php index d1f922ea..680b04de 100644 --- a/lib/Discovery/Webhooks/Discovery.php +++ b/lib/Discovery/Webhooks/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\Webhooks; -use HubSpot\Client\Webhooks\Api\SettingsApi; -use HubSpot\Client\Webhooks\Api\SubscriptionsApi; +use HubSpot\Client\Webhooks\Api\BasicApi; +use HubSpot\Client\Webhooks\Api\BatchApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method SettingsApi settingsApi() - * @method SubscriptionsApi subscriptionsApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() */ class Discovery extends DiscoveryBase {} diff --git a/tests/spec/Discovery/Cms/AuditLogs/DiscoverySpec.php b/tests/spec/Discovery/Cms/AuditLogs/DiscoverySpec.php index 35c95155..9aa9405b 100644 --- a/tests/spec/Discovery/Cms/AuditLogs/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/AuditLogs/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\AuditLogs; use GuzzleHttp\Client; -use HubSpot\Client\Cms\AuditLogs\Api\AuditLogsApi; +use HubSpot\Client\Cms\AuditLogs\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\AuditLogs\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->auditLogsApi()->shouldHaveType(AuditLogsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Cms/Blogs/Authors/DiscoverySpec.php b/tests/spec/Discovery/Cms/Blogs/Authors/DiscoverySpec.php index 03a364b7..1801c58e 100644 --- a/tests/spec/Discovery/Cms/Blogs/Authors/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Blogs/Authors/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\Blogs\Authors; use GuzzleHttp\Client; -use HubSpot\Client\Cms\Blogs\Authors\Api\BlogAuthorsApi; +use HubSpot\Client\Cms\Blogs\Authors\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Blogs\Authors\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->blogAuthorsApi()->shouldHaveType(BlogAuthorsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Cms/Blogs/Tags/DiscoverySpec.php b/tests/spec/Discovery/Cms/Blogs/Tags/DiscoverySpec.php index 66945bec..cad778f3 100644 --- a/tests/spec/Discovery/Cms/Blogs/Tags/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Blogs/Tags/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\Blogs\Tags; use GuzzleHttp\Client; -use HubSpot\Client\Cms\Blogs\Tags\Api\BlogTagsApi; +use HubSpot\Client\Cms\Blogs\Tags\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Blogs\Tags\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->blogTagsApi()->shouldHaveType(BlogTagsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Cms/Domains/DiscoverySpec.php b/tests/spec/Discovery/Cms/Domains/DiscoverySpec.php index b577a004..5e71e11b 100644 --- a/tests/spec/Discovery/Cms/Domains/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Domains/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\Domains; use GuzzleHttp\Client; -use HubSpot\Client\Cms\Domains\Api\DomainsApi; +use HubSpot\Client\Cms\Domains\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Domains\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->domainsApi()->shouldHaveType(DomainsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Cms/SiteSearch/DiscoverySpec.php b/tests/spec/Discovery/Cms/SiteSearch/DiscoverySpec.php index 4809117b..59dbaad6 100644 --- a/tests/spec/Discovery/Cms/SiteSearch/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/SiteSearch/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\SiteSearch; use GuzzleHttp\Client; -use HubSpot\Client\Cms\SiteSearch\Api\PublicApi; +use HubSpot\Client\Cms\SiteSearch\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\SiteSearch\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->publicApi()->shouldHaveType(PublicApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Cms/SourceCode/DiscoverySpec.php b/tests/spec/Discovery/Cms/SourceCode/DiscoverySpec.php index 490c78c4..7269e447 100644 --- a/tests/spec/Discovery/Cms/SourceCode/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/SourceCode/DiscoverySpec.php @@ -3,10 +3,8 @@ namespace spec\HubSpot\Discovery\Cms\SourceCode; use GuzzleHttp\Client; -use HubSpot\Client\Cms\SourceCode\Api\ContentApi; -use HubSpot\Client\Cms\SourceCode\Api\ExtractApi; -use HubSpot\Client\Cms\SourceCode\Api\MetadataApi; -use HubSpot\Client\Cms\SourceCode\Api\ValidationApi; +use HubSpot\Client\Cms\SourceCode\Api\AdvancedApi; +use HubSpot\Client\Cms\SourceCode\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\SourceCode\Discovery; use PhpSpec\ObjectBehavior; @@ -25,9 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->contentApi()->shouldHaveType(ContentApi::class); - $this->extractApi()->shouldHaveType(ExtractApi::class); - $this->metadataApi()->shouldHaveType(MetadataApi::class); - $this->validationApi()->shouldHaveType(ValidationApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); } } diff --git a/tests/spec/Discovery/Cms/UrlRedirects/DiscoverySpec.php b/tests/spec/Discovery/Cms/UrlRedirects/DiscoverySpec.php index b7c95e5a..7198c272 100644 --- a/tests/spec/Discovery/Cms/UrlRedirects/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/UrlRedirects/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Cms\UrlRedirects; use GuzzleHttp\Client; -use HubSpot\Client\Cms\UrlRedirects\Api\RedirectsApi; +use HubSpot\Client\Cms\UrlRedirects\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Cms\UrlRedirects\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->redirectsApi()->shouldHaveType(RedirectsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php b/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php index 84cd4d91..adeffcd3 100644 --- a/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php +++ b/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\CommunicationPreferences; use GuzzleHttp\Client; -use HubSpot\Client\CommunicationPreferences\Api\DefinitionsApi; -use HubSpot\Client\CommunicationPreferences\Api\StatusApi; +use HubSpot\Client\CommunicationPreferences\Api\AdvancedApi; +use HubSpot\Client\CommunicationPreferences\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\CommunicationPreferences\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->definitionsApi()->shouldHaveType(DefinitionsApi::class); - $this->statusApi()->shouldHaveType(StatusApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); } } diff --git a/tests/spec/Discovery/Conversations/VisitorIdentification/DiscoverySpec.php b/tests/spec/Discovery/Conversations/VisitorIdentification/DiscoverySpec.php index 7e809f91..16355a56 100644 --- a/tests/spec/Discovery/Conversations/VisitorIdentification/DiscoverySpec.php +++ b/tests/spec/Discovery/Conversations/VisitorIdentification/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Conversations\VisitorIdentification; use GuzzleHttp\Client; -use HubSpot\Client\Conversations\VisitorIdentification\Api\GenerateApi; +use HubSpot\Client\Conversations\VisitorIdentification\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Conversations\VisitorIdentification\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->generateApi()->shouldHaveType(GenerateApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Crm/Associations/Schema/DiscoverySpec.php b/tests/spec/Discovery/Crm/Associations/Schema/DiscoverySpec.php index 621a4d7b..7d3fa99a 100644 --- a/tests/spec/Discovery/Crm/Associations/Schema/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Associations/Schema/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Associations\Schema; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Associations\Schema\Api\TypesApi; +use HubSpot\Client\Crm\Associations\Schema\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Associations\Schema\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->typesApi()->shouldHaveType(TypesApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php b/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php index e76f38bb..8ae2fdf5 100644 --- a/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php @@ -3,8 +3,8 @@ 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\Client\Crm\Associations\V4\Schema\Api\LabelsApi; +use HubSpot\Client\Crm\Associations\V4\Schema\Api\LimitsApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Associations\V4\Schema\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->definitionsApi()->shouldHaveType(DefinitionsApi::class); - $this->definitionConfigurationsApi()->shouldHaveType(DefinitionConfigurationsApi::class); + $this->labelsApi()->shouldHaveType(LabelsApi::class); + $this->limitsApi()->shouldHaveType(LimitsApi::class); } } diff --git a/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php b/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php index 2226aa60..db5bdc8b 100644 --- a/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Exports/DiscoverySpec.php @@ -3,7 +3,8 @@ namespace spec\HubSpot\Discovery\Crm\Exports; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Exports\Api\PublicExportsApi; +use HubSpot\Client\Crm\Exports\Api\AdvancedApi; +use HubSpot\Client\Crm\Exports\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Exports\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->publicExportsApi()->shouldHaveType(PublicExportsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); } } diff --git a/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php b/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php index 0a2f37fe..5deb934e 100644 --- a/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php @@ -3,9 +3,9 @@ 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\Client\Crm\Extensions\Calling\Api\AdvancedApi; +use HubSpot\Client\Crm\Extensions\Calling\Api\BasicApi; +use HubSpot\Client\Crm\Extensions\Calling\Api\BatchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Extensions\Calling\Discovery; use PhpSpec\ObjectBehavior; @@ -24,8 +24,8 @@ 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); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); } } diff --git a/tests/spec/Discovery/Crm/Extensions/Cards/DiscoverySpec.php b/tests/spec/Discovery/Crm/Extensions/Cards/DiscoverySpec.php index 9438cccd..b7d74343 100644 --- a/tests/spec/Discovery/Crm/Extensions/Cards/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Extensions/Cards/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\Crm\Extensions\Cards; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Extensions\Cards\Api\CardsApi; -use HubSpot\Client\Crm\Extensions\Cards\Api\SampleResponseApi; +use HubSpot\Client\Crm\Extensions\Cards\Api\AdvancedApi; +use HubSpot\Client\Crm\Extensions\Cards\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Extensions\Cards\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->cardsApi()->shouldHaveType(CardsApi::class); - $this->sampleResponseApi()->shouldHaveType(SampleResponseApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); } } diff --git a/tests/spec/Discovery/Crm/Extensions/Videoconferencing/DiscoverySpec.php b/tests/spec/Discovery/Crm/Extensions/Videoconferencing/DiscoverySpec.php index cebcb8fa..3830735e 100644 --- a/tests/spec/Discovery/Crm/Extensions/Videoconferencing/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Extensions/Videoconferencing/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Extensions\Videoconferencing; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Extensions\Videoconferencing\Api\SettingsApi; +use HubSpot\Client\Crm\Extensions\Videoconferencing\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Extensions\Videoconferencing\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->settingsApi()->shouldHaveType(SettingsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Crm/Imports/DiscoverySpec.php b/tests/spec/Discovery/Crm/Imports/DiscoverySpec.php index 3d3cecdf..f448557f 100644 --- a/tests/spec/Discovery/Crm/Imports/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Imports/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\Crm\Imports; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Imports\Api\CoreApi; -use HubSpot\Client\Crm\Imports\Api\PublicImportsApi; +use HubSpot\Client\Crm\Imports\Api\AdvancedApi; +use HubSpot\Client\Crm\Imports\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Imports\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->coreApi()->shouldHaveType(CoreApi::class); - $this->publicImportsApi()->shouldHaveType(PublicImportsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); } } diff --git a/tests/spec/Discovery/Crm/Owners/DiscoverySpec.php b/tests/spec/Discovery/Crm/Owners/DiscoverySpec.php index ed7dd648..5faaffec 100644 --- a/tests/spec/Discovery/Crm/Owners/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Owners/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Owners; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Owners\Api\OwnersApi; +use HubSpot\Client\Crm\Owners\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Owners\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->ownersApi()->shouldHaveType(OwnersApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Crm/Pipelines/DiscoverySpec.php b/tests/spec/Discovery/Crm/Pipelines/DiscoverySpec.php index c25e1079..1a831bad 100644 --- a/tests/spec/Discovery/Crm/Pipelines/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Pipelines/DiscoverySpec.php @@ -3,10 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Pipelines; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Pipelines\Api\PipelineAuditsApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelinesApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelineStageAuditsApi; -use HubSpot\Client\Crm\Pipelines\Api\PipelineStagesApi; +use HubSpot\Client\Crm\Pipelines\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Pipelines\Discovery; use PhpSpec\ObjectBehavior; @@ -25,9 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->pipelineAuditsApi()->shouldHaveType(PipelineAuditsApi::class); - $this->pipelinesApi()->shouldHaveType(PipelinesApi::class); - $this->pipelineStageAuditsApi()->shouldHaveType(PipelineStageAuditsApi::class); - $this->pipelineStagesApi()->shouldHaveType(PipelineStagesApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Crm/Properties/DiscoverySpec.php b/tests/spec/Discovery/Crm/Properties/DiscoverySpec.php index 0a3a46ad..ff52064e 100644 --- a/tests/spec/Discovery/Crm/Properties/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Properties/DiscoverySpec.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Properties\Api\BatchApi; use HubSpot\Client\Crm\Properties\Api\CoreApi; -use HubSpot\Client\Crm\Properties\Api\GroupsApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Properties\Discovery; use PhpSpec\ObjectBehavior; @@ -26,6 +25,5 @@ public function it_creates_clients() { $this->coreApi()->shouldHaveType(CoreApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->groupsApi()->shouldHaveType(GroupsApi::class); } } diff --git a/tests/spec/Discovery/Crm/Schemas/DiscoverySpec.php b/tests/spec/Discovery/Crm/Schemas/DiscoverySpec.php index bae7a8ee..b6b91876 100644 --- a/tests/spec/Discovery/Crm/Schemas/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Schemas/DiscoverySpec.php @@ -3,7 +3,9 @@ namespace spec\HubSpot\Discovery\Crm\Schemas; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Schemas\Api\CoreApi; +use HubSpot\Client\Crm\Schemas\Api\AdvancedApi; +use HubSpot\Client\Crm\Schemas\Api\BasicApi; +use HubSpot\Client\Crm\Schemas\Api\BatchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Schemas\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +24,8 @@ public function it_is_initializable() public function it_creates_clients() { - $this->coreApi()->shouldHaveType(CoreApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); } } diff --git a/tests/spec/Discovery/Crm/Timeline/DiscoverySpec.php b/tests/spec/Discovery/Crm/Timeline/DiscoverySpec.php index 67e1cd1d..d179ac65 100644 --- a/tests/spec/Discovery/Crm/Timeline/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Timeline/DiscoverySpec.php @@ -3,9 +3,9 @@ namespace spec\HubSpot\Discovery\Crm\Timeline; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Timeline\Api\EventsApi; -use HubSpot\Client\Crm\Timeline\Api\TemplatesApi; -use HubSpot\Client\Crm\Timeline\Api\TokensApi; +use HubSpot\Client\Crm\Timeline\Api\AdvancedApi; +use HubSpot\Client\Crm\Timeline\Api\BasicApi; +use HubSpot\Client\Crm\Timeline\Api\BatchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Timeline\Discovery; use PhpSpec\ObjectBehavior; @@ -24,8 +24,8 @@ public function it_is_initializable() public function it_creates_clients() { - $this->eventsApi()->shouldHaveType(EventsApi::class); - $this->templatesApi()->shouldHaveType(TemplatesApi::class); - $this->tokensApi()->shouldHaveType(TokensApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); } } diff --git a/tests/spec/Discovery/Events/DiscoverySpec.php b/tests/spec/Discovery/Events/DiscoverySpec.php index c09be1b0..8e0d541f 100644 --- a/tests/spec/Discovery/Events/DiscoverySpec.php +++ b/tests/spec/Discovery/Events/DiscoverySpec.php @@ -3,9 +3,10 @@ namespace spec\HubSpot\Discovery\Events; use GuzzleHttp\Client; -use HubSpot\Client\Events\Api\EventsApi; +use HubSpot\Client\Events\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Events\Discovery; +use HubSpot\Discovery\Events\Send\Discovery as SendDiscovery; use PhpSpec\ObjectBehavior; class DiscoverySpec extends ObjectBehavior @@ -22,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->eventsApi()->shouldHaveType(EventsApi::class); - $this->send()->shouldHaveType(\HubSpot\Discovery\Events\Send\Discovery::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->send()->shouldHaveType(SendDiscovery::class); } } diff --git a/tests/spec/Discovery/Marketing/Forms/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Forms/DiscoverySpec.php index 742e4654..377ea708 100644 --- a/tests/spec/Discovery/Marketing/Forms/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/Forms/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Marketing\Forms; use GuzzleHttp\Client; -use HubSpot\Client\Marketing\Forms\Api\FormsApi; +use HubSpot\Client\Marketing\Forms\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Marketing\Forms\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->formsApi()->shouldHaveType(FormsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Settings/BusinessUnits/DiscoverySpec.php b/tests/spec/Discovery/Settings/BusinessUnits/DiscoverySpec.php index 09ca5154..277466f9 100644 --- a/tests/spec/Discovery/Settings/BusinessUnits/DiscoverySpec.php +++ b/tests/spec/Discovery/Settings/BusinessUnits/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\Settings\BusinessUnits; use GuzzleHttp\Client; -use HubSpot\Client\Settings\BusinessUnits\Api\BusinessUnitsApi; +use HubSpot\Client\Settings\BusinessUnits\Api\BasicApi; use HubSpot\Config; use HubSpot\Discovery\Settings\BusinessUnits\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +22,6 @@ public function it_is_initializable() public function it_creates_clients() { - $this->businessUnitsApi()->shouldHaveType(BusinessUnitsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); } } diff --git a/tests/spec/Discovery/Webhooks/DiscoverySpec.php b/tests/spec/Discovery/Webhooks/DiscoverySpec.php index 6e2889b8..6bd198c0 100644 --- a/tests/spec/Discovery/Webhooks/DiscoverySpec.php +++ b/tests/spec/Discovery/Webhooks/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\Webhooks; use GuzzleHttp\Client; -use HubSpot\Client\Webhooks\Api\SettingsApi; -use HubSpot\Client\Webhooks\Api\SubscriptionsApi; +use HubSpot\Client\Webhooks\Api\BasicApi; +use HubSpot\Client\Webhooks\Api\BatchApi; use HubSpot\Config; use HubSpot\Discovery\Webhooks\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->settingsApi()->shouldHaveType(SettingsApi::class); - $this->subscriptionsApi()->shouldHaveType(SubscriptionsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); } } From d1a8f2fd40b5249f77f053efafd89ce558640b69 Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Tue, 22 Sep 2026 14:54:08 -0400 Subject: [PATCH 4/5] Fix four more Discovery classes missed in initial repoint - Cms/Hubdb: remove deleted RowsBatchApi - Cms/Pages: remove deleted SitePagesApi, add 7 new APIs from regen - Crm/Lists: replace 5 deleted APIs with BasicApi/BatchApi/SearchApi - Marketing/Emails: remove deleted StatisticsApi, add BasicApi Co-Authored-By: Claude Sonnet 4.6 --- lib/Discovery/Cms/Hubdb/Discovery.php | 6 ++--- lib/Discovery/Cms/Pages/Discovery.php | 16 +++++++++-- lib/Discovery/Crm/Lists/Discovery.php | 27 +++++-------------- lib/Discovery/Marketing/Emails/Discovery.php | 6 ++--- .../Discovery/Cms/Hubdb/DiscoverySpec.php | 2 -- .../Discovery/Cms/Pages/DiscoverySpec.php | 16 +++++++++-- .../Discovery/Crm/Lists/DiscoverySpec.php | 16 +++++------ .../Marketing/Emails/DiscoverySpec.php | 4 +-- 8 files changed, 48 insertions(+), 45 deletions(-) diff --git a/lib/Discovery/Cms/Hubdb/Discovery.php b/lib/Discovery/Cms/Hubdb/Discovery.php index b9da8b5c..f1a013b8 100644 --- a/lib/Discovery/Cms/Hubdb/Discovery.php +++ b/lib/Discovery/Cms/Hubdb/Discovery.php @@ -3,13 +3,11 @@ namespace HubSpot\Discovery\Cms\Hubdb; use HubSpot\Client\Cms\Hubdb\Api\RowsApi; -use HubSpot\Client\Cms\Hubdb\Api\RowsBatchApi; use HubSpot\Client\Cms\Hubdb\Api\TablesApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method RowsApi rowsApi() - * @method RowsBatchApi rowsBatchApi() - * @method TablesApi tablesApi() + * @method RowsApi rowsApi() + * @method TablesApi tablesApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/Pages/Discovery.php b/lib/Discovery/Cms/Pages/Discovery.php index 494faacd..8079be45 100644 --- a/lib/Discovery/Cms/Pages/Discovery.php +++ b/lib/Discovery/Cms/Pages/Discovery.php @@ -2,12 +2,24 @@ namespace HubSpot\Discovery\Cms\Pages; +use HubSpot\Client\Cms\Pages\Api\ABTestsApi; +use HubSpot\Client\Cms\Pages\Api\AdvancedApi; +use HubSpot\Client\Cms\Pages\Api\BasicApi; +use HubSpot\Client\Cms\Pages\Api\BatchApi; +use HubSpot\Client\Cms\Pages\Api\FoldersApi; use HubSpot\Client\Cms\Pages\Api\LandingPagesApi; -use HubSpot\Client\Cms\Pages\Api\SitePagesApi; +use HubSpot\Client\Cms\Pages\Api\MultiLanguageApi; +use HubSpot\Client\Cms\Pages\Api\WebsitePagesApi; use HubSpot\Discovery\DiscoveryBase; /** + * @method ABTestsApi abTestsApi() + * @method AdvancedApi advancedApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method FoldersApi foldersApi() * @method LandingPagesApi landingPagesApi() - * @method SitePagesApi sitePagesApi() + * @method MultiLanguageApi multiLanguageApi() + * @method WebsitePagesApi websitePagesApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Crm/Lists/Discovery.php b/lib/Discovery/Crm/Lists/Discovery.php index 4ef7d71d..9c2538ed 100644 --- a/lib/Discovery/Crm/Lists/Discovery.php +++ b/lib/Discovery/Crm/Lists/Discovery.php @@ -2,27 +2,14 @@ namespace HubSpot\Discovery\Crm\Lists; -use HubSpot\Client\Crm\Lists\Api\IDMappingApi; -use HubSpot\Client\Crm\Lists\Api\JoinOrderApi; -use HubSpot\Client\Crm\Lists\Api\ListManagementApi; -use HubSpot\Client\Crm\Lists\Api\ListsApi; -use HubSpot\Client\Crm\Lists\Api\MembershipsApi; -use HubSpot\Client\Crm\Lists\Configuration; +use HubSpot\Client\Crm\Lists\Api\BasicApi; +use HubSpot\Client\Crm\Lists\Api\BatchApi; +use HubSpot\Client\Crm\Lists\Api\SearchApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method IDMappingApi idMappingApi() - * @method JoinOrderApi joinOrderApi() - * @method ListManagementApi listManagementApi() - * @method ListsApi listsApi() - * @method MembershipsApi membershipsApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method SearchApi searchApi() */ -class Discovery extends DiscoveryBase -{ - public function idMappingApi() - { - $config = $this->config->convertToClientConfig(Configuration::class); - - return new IDMappingApi($this->client, $config); - } -} +class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Marketing/Emails/Discovery.php b/lib/Discovery/Marketing/Emails/Discovery.php index 488176f9..f960262d 100644 --- a/lib/Discovery/Marketing/Emails/Discovery.php +++ b/lib/Discovery/Marketing/Emails/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\Marketing\Emails; +use HubSpot\Client\Marketing\Emails\Api\BasicApi; use HubSpot\Client\Marketing\Emails\Api\EmailsApi; -use HubSpot\Client\Marketing\Emails\Api\StatisticsApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method EmailsApi emailsApi() - * @method StatisticsApi statisticsApi() + * @method BasicApi basicApi() + * @method EmailsApi emailsApi() */ class Discovery extends DiscoveryBase {} diff --git a/tests/spec/Discovery/Cms/Hubdb/DiscoverySpec.php b/tests/spec/Discovery/Cms/Hubdb/DiscoverySpec.php index d9f92da7..05dea0e4 100644 --- a/tests/spec/Discovery/Cms/Hubdb/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Hubdb/DiscoverySpec.php @@ -4,7 +4,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Cms\Hubdb\Api\RowsApi; -use HubSpot\Client\Cms\Hubdb\Api\RowsBatchApi; use HubSpot\Client\Cms\Hubdb\Api\TablesApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Hubdb\Discovery; @@ -25,7 +24,6 @@ public function it_is_initializable() public function it_creates_clients() { $this->rowsApi()->shouldHaveType(RowsApi::class); - $this->rowsBatchApi()->shouldHaveType(RowsBatchApi::class); $this->tablesApi()->shouldHaveType(TablesApi::class); } } diff --git a/tests/spec/Discovery/Cms/Pages/DiscoverySpec.php b/tests/spec/Discovery/Cms/Pages/DiscoverySpec.php index a099ca2f..eb0cc11e 100644 --- a/tests/spec/Discovery/Cms/Pages/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Pages/DiscoverySpec.php @@ -3,8 +3,14 @@ namespace spec\HubSpot\Discovery\Cms\Pages; use GuzzleHttp\Client; +use HubSpot\Client\Cms\Pages\Api\ABTestsApi; +use HubSpot\Client\Cms\Pages\Api\AdvancedApi; +use HubSpot\Client\Cms\Pages\Api\BasicApi; +use HubSpot\Client\Cms\Pages\Api\BatchApi; +use HubSpot\Client\Cms\Pages\Api\FoldersApi; use HubSpot\Client\Cms\Pages\Api\LandingPagesApi; -use HubSpot\Client\Cms\Pages\Api\SitePagesApi; +use HubSpot\Client\Cms\Pages\Api\MultiLanguageApi; +use HubSpot\Client\Cms\Pages\Api\WebsitePagesApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Pages\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +29,13 @@ public function it_is_initializable() public function it_creates_clients() { + $this->abTestsApi()->shouldHaveType(ABTestsApi::class); + $this->advancedApi()->shouldHaveType(AdvancedApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); + $this->foldersApi()->shouldHaveType(FoldersApi::class); $this->landingPagesApi()->shouldHaveType(LandingPagesApi::class); - $this->sitePagesApi()->shouldHaveType(SitePagesApi::class); + $this->multiLanguageApi()->shouldHaveType(MultiLanguageApi::class); + $this->websitePagesApi()->shouldHaveType(WebsitePagesApi::class); } } diff --git a/tests/spec/Discovery/Crm/Lists/DiscoverySpec.php b/tests/spec/Discovery/Crm/Lists/DiscoverySpec.php index 530c6233..2b38e020 100644 --- a/tests/spec/Discovery/Crm/Lists/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Lists/DiscoverySpec.php @@ -3,11 +3,9 @@ namespace spec\HubSpot\Discovery\Crm\Lists; use GuzzleHttp\Client; -use HubSpot\Client\Crm\Lists\Api\IDMappingApi; -use HubSpot\Client\Crm\Lists\Api\JoinOrderApi; -use HubSpot\Client\Crm\Lists\Api\ListManagementApi; -use HubSpot\Client\Crm\Lists\Api\ListsApi; -use HubSpot\Client\Crm\Lists\Api\MembershipsApi; +use HubSpot\Client\Crm\Lists\Api\BasicApi; +use HubSpot\Client\Crm\Lists\Api\BatchApi; +use HubSpot\Client\Crm\Lists\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Lists\Discovery; use PhpSpec\ObjectBehavior; @@ -26,10 +24,8 @@ public function it_is_initializable() public function it_creates_clients() { - $this->idMappingApi()->shouldHaveType(IDMappingApi::class); - $this->joinOrderApi()->shouldHaveType(JoinOrderApi::class); - $this->listManagementApi()->shouldHaveType(ListManagementApi::class); - $this->listsApi()->shouldHaveType(ListsApi::class); - $this->membershipsApi()->shouldHaveType(MembershipsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); + $this->searchApi()->shouldHaveType(SearchApi::class); } } diff --git a/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php index 2afddb44..f939314b 100644 --- a/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/Emails/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\Marketing\Emails; use GuzzleHttp\Client; +use HubSpot\Client\Marketing\Emails\Api\BasicApi; use HubSpot\Client\Marketing\Emails\Api\EmailsApi; -use HubSpot\Client\Marketing\Emails\Api\StatisticsApi; use HubSpot\Config; use HubSpot\Discovery\Marketing\Emails\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { + $this->basicApi()->shouldHaveType(BasicApi::class); $this->emailsApi()->shouldHaveType(EmailsApi::class); - $this->statisticsApi()->shouldHaveType(StatisticsApi::class); } } From a80ad5548dd9dc9ae235f56c45d80da024e604fa Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Wed, 23 Sep 2026 11:37:05 -0400 Subject: [PATCH 5/5] Fix Cms/Pages abTestsApi: add explicit method for ABTestsApi class DiscoveryBase::__call resolves via ucfirst(), so abTestsApi() becomes AbTestsApi, which doesn't match the actual class ABTestsApi. Add an explicit method to bypass __call for this one accessor. Co-Authored-By: Claude Sonnet 4.6 --- lib/Discovery/Cms/Pages/Discovery.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/Discovery/Cms/Pages/Discovery.php b/lib/Discovery/Cms/Pages/Discovery.php index 8079be45..8b2dbf53 100644 --- a/lib/Discovery/Cms/Pages/Discovery.php +++ b/lib/Discovery/Cms/Pages/Discovery.php @@ -10,16 +10,25 @@ use HubSpot\Client\Cms\Pages\Api\LandingPagesApi; use HubSpot\Client\Cms\Pages\Api\MultiLanguageApi; use HubSpot\Client\Cms\Pages\Api\WebsitePagesApi; +use HubSpot\Client\Cms\Pages\Configuration; use HubSpot\Discovery\DiscoveryBase; /** - * @method ABTestsApi abTestsApi() - * @method AdvancedApi advancedApi() - * @method BasicApi basicApi() - * @method BatchApi batchApi() - * @method FoldersApi foldersApi() - * @method LandingPagesApi landingPagesApi() + * @method ABTestsApi abTestsApi() + * @method AdvancedApi advancedApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method FoldersApi foldersApi() + * @method LandingPagesApi landingPagesApi() * @method MultiLanguageApi multiLanguageApi() - * @method WebsitePagesApi websitePagesApi() + * @method WebsitePagesApi websitePagesApi() */ -class Discovery extends DiscoveryBase {} +class Discovery extends DiscoveryBase +{ + public function abTestsApi(): ABTestsApi + { + $config = $this->config->convertToClientConfig(Configuration::class); + + return new ABTestsApi($this->client, $config); + } +}