From 45d56803561cde061b7bc36da4fa2494f7c9c16d Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 21 Oct 2024 14:49:17 +0300 Subject: [PATCH 1/2] Codegen: Marketing Events --- .../AttendanceSubscriberStateChangesApi.php | 186 +- codegen/Marketing/Events/Api/BasicApi.php | 1850 +++++++++++++-- codegen/Marketing/Events/Api/BatchApi.php | 801 ------- .../Events/Api/ListAssociationsApi.php | 1954 +++++++++++++++ .../Events/Api/MarketingEventsExternalApi.php | 521 ---- .../Events/Api/ParticipantStateApi.php | 2090 +++++++++++++++++ codegen/Marketing/Events/Api/SearchApi.php | 490 ---- codegen/Marketing/Events/Api/SettingsApi.php | 168 +- .../Events/Api/SubscriberStateChangesApi.php | 194 +- codegen/Marketing/Events/ApiException.php | 2 +- codegen/Marketing/Events/Configuration.php | 2 +- codegen/Marketing/Events/HeaderSelector.php | 2 +- .../Events/Model/AttendanceCounters.php | 523 +++++ ...InputMarketingEventCreateRequestParams.php | 2 +- ...atchInputMarketingEventEmailSubscriber.php | 3 +- ...MarketingEventExternalUniqueIdentifier.php | 2 +- .../BatchInputMarketingEventSubscriber.php | 3 +- ...nseMarketingEventPublicDefaultResponse.php | 2 +- .../BatchResponseSubscriberEmailResponse.php | 2 +- .../BatchResponseSubscriberVidResponse.php | 2 +- ...gEventExternalUniqueIdentifierNoPaging.php | 2 +- ...talParticipationBreakdownForwardPaging.php | 483 ++++ ...ionResponseWithTotalPublicListNoPaging.php | 449 ++++ .../Events/Model/ContactAssociation.php | 517 ++++ codegen/Marketing/Events/Model/Error.php | 2 +- .../Marketing/Events/Model/ErrorDetail.php | 2 +- .../Events/Model/EventDetailSettings.php | 2 +- .../Events/Model/EventDetailSettingsUrl.php | 2 +- .../Marketing/Events/Model/ForwardPaging.php | 409 ++++ .../Model/MarketingEventAssociation.php | 517 ++++ .../MarketingEventCompleteRequestParams.php | 2 +- .../MarketingEventCreateRequestParams.php | 36 +- .../Model/MarketingEventDefaultResponse.php | 36 +- .../Model/MarketingEventEmailSubscriber.php | 2 +- ...MarketingEventExternalUniqueIdentifier.php | 2 +- .../MarketingEventPublicDefaultResponse.php | 312 +-- .../MarketingEventPublicReadResponse.php | 36 +- .../Events/Model/MarketingEventSubscriber.php | 2 +- .../MarketingEventUpdateRequestParams.php | 36 +- .../Marketing/Events/Model/ModelInterface.php | 2 +- codegen/Marketing/Events/Model/NextPage.php | 446 ++++ .../Model/ParticipationAssociations.php | 449 ++++ .../Events/Model/ParticipationBreakdown.php | 523 +++++ .../Events/Model/ParticipationProperties.php | 557 +++++ .../Marketing/Events/Model/PropertyValue.php | 173 +- codegen/Marketing/Events/Model/PublicList.php | 835 +++++++ .../Marketing/Events/Model/StandardError.php | 2 +- .../Events/Model/SubscriberEmailResponse.php | 2 +- .../Events/Model/SubscriberVidResponse.php | 2 +- codegen/Marketing/Events/ObjectSerializer.php | 2 +- 50 files changed, 12160 insertions(+), 2481 deletions(-) delete mode 100644 codegen/Marketing/Events/Api/BatchApi.php create mode 100644 codegen/Marketing/Events/Api/ListAssociationsApi.php delete mode 100644 codegen/Marketing/Events/Api/MarketingEventsExternalApi.php create mode 100644 codegen/Marketing/Events/Api/ParticipantStateApi.php delete mode 100644 codegen/Marketing/Events/Api/SearchApi.php create mode 100644 codegen/Marketing/Events/Model/AttendanceCounters.php create mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php create mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php create mode 100644 codegen/Marketing/Events/Model/ContactAssociation.php create mode 100644 codegen/Marketing/Events/Model/ForwardPaging.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventAssociation.php create mode 100644 codegen/Marketing/Events/Model/NextPage.php create mode 100644 codegen/Marketing/Events/Model/ParticipationAssociations.php create mode 100644 codegen/Marketing/Events/Model/ParticipationBreakdown.php create mode 100644 codegen/Marketing/Events/Model/ParticipationProperties.php create mode 100644 codegen/Marketing/Events/Model/PublicList.php diff --git a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php index c4ac84f3..6a163ea4 100644 --- a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -71,10 +71,10 @@ class AttendanceSubscriberStateChangesApi /** @var string[] $contentTypes **/ public const contentTypes = [ - 'create' => [ + 'recordByContactEmails' => [ 'application/json', ], - 'createByEmail' => [ + 'recordByContactIds' => [ 'application/json', ], ]; @@ -126,44 +126,44 @@ public function getConfig() } /** - * Operation create + * Operation recordByContactEmails * - * Record + * Record a subscriber state by contact email * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function create($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['create'][0]) + public function recordByContactEmails($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) { - list($response) = $this->createWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + list($response) = $this->recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation recordByContactEmailsWithHttpInfo * - * Record + * Record a subscriber state by contact email * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['create'][0]) + public function recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) { - $request = $this->createRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -202,11 +202,11 @@ public function createWithHttpInfo($external_event_id, $subscriber_state, $batch switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -224,7 +224,7 @@ public function createWithHttpInfo($external_event_id, $subscriber_state, $batch } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -257,7 +257,7 @@ public function createWithHttpInfo($external_event_id, $subscriber_state, $batch ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -290,7 +290,7 @@ public function createWithHttpInfo($external_event_id, $subscriber_state, $batch case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -309,22 +309,22 @@ public function createWithHttpInfo($external_event_id, $subscriber_state, $batch } /** - * Operation createAsync + * Operation recordByContactEmailsAsync * - * Record + * Record a subscriber state by contact email * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['create'][0]) + public function recordByContactEmailsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) { - return $this->createAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) + return $this->recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -333,23 +333,23 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation recordByContactEmailsAsyncWithHttpInfo * - * Record + * Record a subscriber state by contact email * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['create'][0]) + public function recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; - $request = $this->createRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -388,44 +388,44 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'recordByContactEmails' * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['create'][0]) + public function recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling create' + 'Missing the required parameter $external_event_id when calling recordByContactEmails' ); } // verify the required parameter 'subscriber_state' is set if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling create' + 'Missing the required parameter $subscriber_state when calling recordByContactEmails' ); } - // verify the required parameter 'batch_input_marketing_event_subscriber' is set - if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set + if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_subscriber when calling create' + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByContactEmails' ); } - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; $formParams = []; $queryParams = []; $headerParams = []; @@ -468,12 +468,12 @@ public function createRequest($external_event_id, $subscriber_state, $batch_inpu ); // for model (json/xml) - if (isset($batch_input_marketing_event_subscriber)) { + if (isset($batch_input_marketing_event_email_subscriber)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); } else { - $httpBody = $batch_input_marketing_event_subscriber; + $httpBody = $batch_input_marketing_event_email_subscriber; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -526,44 +526,44 @@ public function createRequest($external_event_id, $subscriber_state, $batch_inpu } /** - * Operation createByEmail + * Operation recordByContactIds * - * Record + * Record a subscriber state by contact ids * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createByEmail'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function createByEmail($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['createByEmail'][0]) + public function recordByContactIds($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) { - list($response) = $this->createByEmailWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + list($response) = $this->recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); return $response; } /** - * Operation createByEmailWithHttpInfo + * Operation recordByContactIdsWithHttpInfo * - * Record + * Record a subscriber state by contact ids * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createByEmail'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['createByEmail'][0]) + public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) { - $request = $this->createByEmailRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -602,11 +602,11 @@ public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -624,7 +624,7 @@ public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -657,7 +657,7 @@ public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -690,7 +690,7 @@ public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -709,22 +709,22 @@ public function createByEmailWithHttpInfo($external_event_id, $subscriber_state, } /** - * Operation createByEmailAsync + * Operation recordByContactIdsAsync * - * Record + * Record a subscriber state by contact ids * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createByEmail'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createByEmailAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['createByEmail'][0]) + public function recordByContactIdsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) { - return $this->createByEmailAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) + return $this->recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -733,23 +733,23 @@ function ($response) { } /** - * Operation createByEmailAsyncWithHttpInfo + * Operation recordByContactIdsAsyncWithHttpInfo * - * Record + * Record a subscriber state by contact ids * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createByEmail'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createByEmailAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['createByEmail'][0]) + public function recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; - $request = $this->createByEmailRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -788,44 +788,44 @@ function ($exception) { } /** - * Create request for operation 'createByEmail' + * Create request for operation 'recordByContactIds' * * @param string $external_event_id The id of the marketing event (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event. Parameters of join and left time if state is Attended. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createByEmail'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createByEmailRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['createByEmail'][0]) + public function recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling createByEmail' + 'Missing the required parameter $external_event_id when calling recordByContactIds' ); } // verify the required parameter 'subscriber_state' is set if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling createByEmail' + 'Missing the required parameter $subscriber_state when calling recordByContactIds' ); } - // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set - if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + // verify the required parameter 'batch_input_marketing_event_subscriber' is set + if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling createByEmail' + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactIds' ); } - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; $formParams = []; $queryParams = []; $headerParams = []; @@ -868,12 +868,12 @@ public function createByEmailRequest($external_event_id, $subscriber_state, $bat ); // for model (json/xml) - if (isset($batch_input_marketing_event_email_subscriber)) { + if (isset($batch_input_marketing_event_subscriber)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); } else { - $httpBody = $batch_input_marketing_event_email_subscriber; + $httpBody = $batch_input_marketing_event_subscriber; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Marketing/Events/Api/BasicApi.php b/codegen/Marketing/Events/Api/BasicApi.php index 786cf287..3800315a 100644 --- a/codegen/Marketing/Events/Api/BasicApi.php +++ b/codegen/Marketing/Events/Api/BasicApi.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -74,21 +74,33 @@ class BasicApi 'archive' => [ 'application/json', ], - 'create' => [ + 'batchArchive' => [ + 'application/json', + ], + 'batchUpsert' => [ + 'application/json', + ], + 'cancel' => [ + 'application/json', + ], + 'complete' => [ 'application/json', ], - 'doCancel' => [ + 'create' => [ 'application/json', ], - 'getById' => [ + 'doSearch' => [ 'application/json', ], - 'replace' => [ + 'getDetails' => [ 'application/json', ], 'update' => [ 'application/json', ], + 'upsert' => [ + 'application/json', + ], ]; /** @@ -207,10 +219,1388 @@ public function archiveWithHttpInfo($external_event_id, $external_account_id, st ); } - return [null, $statusCode, $response->getHeaders()]; + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete a marketing event + * + * @param string $external_event_id The id of the marketing event to delete (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $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($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete a marketing event + * + * @param string $external_event_id The id of the marketing event to delete (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $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($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($external_event_id, $external_account_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 $external_event_id The id of the marketing event to delete (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $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($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling archive' + ); + } + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling archive' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_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 batchArchive + * + * Delete multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\Error + */ + public function batchArchive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + { + list($response) = $this->batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); + return $response; + } + + /** + * Operation batchArchiveWithHttpInfo + * + * Delete multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + { + $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation batchArchiveAsync + * + * Delete multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchArchiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + { + return $this->batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchArchiveAsyncWithHttpInfo + * + * Delete multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; + $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'batchArchive' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set + if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling batchArchive' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_external_unique_identifier)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); + } else { + $httpBody = $batch_input_marketing_event_external_unique_identifier; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation batchUpsert + * + * Create or update multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function batchUpsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + { + list($response) = $this->batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); + return $response; + } + + /** + * Operation batchUpsertWithHttpInfo + * + * Create or update multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + { + $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation batchUpsertAsync + * + * Create or update multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchUpsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + { + return $this->batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchUpsertAsyncWithHttpInfo + * + * Create or update multiple marketing events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'batchUpsert' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchUpsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_create_request_params' is set + if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling batchUpsert' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_create_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); + } else { + $httpBody = $batch_input_marketing_event_create_request_params; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancel + * + * Mark a marketing event as cancelled + * + * @param string $external_event_id The id of the marketing event to mark as cancelled (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function cancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + { + list($response) = $this->cancelWithHttpInfo($external_event_id, $external_account_id, $contentType); + return $response; + } + + /** + * Operation cancelWithHttpInfo + * + * Mark a marketing event as cancelled + * + * @param string $external_event_id The id of the marketing event to mark as cancelled (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + { + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelAsync + * + * Mark a marketing event as cancelled + * + * @param string $external_event_id The id of the marketing event to mark as cancelled (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + { + return $this->cancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelAsyncWithHttpInfo + * + * Mark a marketing event as cancelled + * + * @param string $external_event_id The id of the marketing event to mark as cancelled (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancel' + * + * @param string $external_event_id The id of the marketing event to mark as cancelled (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling cancel' + ); + } + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling cancel' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation complete + * + * Mark a marketing event as completed + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + { + list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + return $response; + } + + /** + * Operation completeWithHttpInfo + * + * Mark a marketing event as completed + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + { + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -225,20 +1615,21 @@ public function archiveWithHttpInfo($external_event_id, $external_account_id, st } /** - * Operation archiveAsync + * Operation completeAsync * - * Delete a marketing event + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - return $this->archiveAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -247,27 +1638,41 @@ function ($response) { } /** - * Operation archiveAsyncWithHttpInfo + * Operation completeAsyncWithHttpInfo * - * Delete a marketing event + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - $returnType = ''; - $request = $this->archiveRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -287,34 +1692,42 @@ function ($exception) { } /** - * Create request for operation 'archive' + * Create request for operation 'complete' * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['archive'][0]) + public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling archive' + 'Missing the required parameter $external_event_id when calling complete' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling archive' + 'Missing the required parameter $external_account_id when calling complete' ); } + // verify the required parameter 'marketing_event_complete_request_params' is set + if ($marketing_event_complete_request_params === null || (is_array($marketing_event_complete_request_params) && count($marketing_event_complete_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_complete_request_params when calling complete' + ); + } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; + + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; $formParams = []; $queryParams = []; $headerParams = []; @@ -343,13 +1756,20 @@ public function archiveRequest($external_event_id, $external_account_id, string $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($marketing_event_complete_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); + } else { + $httpBody = $marketing_event_complete_request_params; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -392,7 +1812,7 @@ public function archiveRequest($external_event_id, $external_account_id, string $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -404,7 +1824,7 @@ public function archiveRequest($external_event_id, $external_account_id, string * * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to create (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -422,7 +1842,7 @@ public function create($marketing_event_create_request_params, string $contentTy * * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to create (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -581,7 +2001,7 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin * * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to create (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -602,7 +2022,7 @@ function ($response) { * * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to create (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -652,7 +2072,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to create (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -745,40 +2165,38 @@ public function createRequest($marketing_event_create_request_params, string $co } /** - * Operation doCancel + * Operation doSearch * - * Mark a marketing event as cancelled + * Search for marketing events * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doCancel'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error */ - public function doCancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['doCancel'][0]) + public function doSearch($q, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doCancelWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->doSearchWithHttpInfo($q, $contentType); return $response; } /** - * Operation doCancelWithHttpInfo + * Operation doSearchWithHttpInfo * - * Mark a marketing event as cancelled + * Search for marketing events * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doCancel'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doCancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['doCancel'][0]) + public function doSearchWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doCancelRequest($external_event_id, $external_account_id, $contentType); + $request = $this->doSearchRequest($q, $contentType); try { $options = $this->createHttpClientOption(); @@ -817,11 +2235,11 @@ public function doCancelWithHttpInfo($external_event_id, $external_account_id, s switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -839,7 +2257,7 @@ public function doCancelWithHttpInfo($external_event_id, $external_account_id, s } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -872,7 +2290,7 @@ public function doCancelWithHttpInfo($external_event_id, $external_account_id, s ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -905,7 +2323,7 @@ public function doCancelWithHttpInfo($external_event_id, $external_account_id, s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -924,20 +2342,19 @@ public function doCancelWithHttpInfo($external_event_id, $external_account_id, s } /** - * Operation doCancelAsync + * Operation doSearchAsync * - * Mark a marketing event as cancelled + * Search for marketing events * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doCancel'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doCancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['doCancel'][0]) + public function doSearchAsync($q, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doCancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->doSearchAsyncWithHttpInfo($q, $contentType) ->then( function ($response) { return $response[0]; @@ -946,21 +2363,20 @@ function ($response) { } /** - * Operation doCancelAsyncWithHttpInfo + * Operation doSearchAsyncWithHttpInfo * - * Mark a marketing event as cancelled + * Search for marketing events * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doCancel'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doCancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['doCancel'][0]) + public function doSearchAsyncWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->doCancelRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; + $request = $this->doSearchRequest($q, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -999,34 +2415,26 @@ function ($exception) { } /** - * Create request for operation 'doCancel' + * Create request for operation 'doSearch' * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doCancel'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doCancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['doCancel'][0]) + public function doSearchRequest($q, string $contentType = self::contentTypes['doSearch'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling doCancel' - ); - } - - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + // verify the required parameter 'q' is set + if ($q === null || (is_array($q) && count($q) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling doCancel' + 'Missing the required parameter $q when calling doSearch' ); } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; + $resourcePath = '/marketing/v3/marketing-events/events/search'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1035,8 +2443,8 @@ public function doCancelRequest($external_event_id, $external_account_id, string // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name + $q, + 'q', // param base name 'string', // openApiType 'form', // style true, // explode @@ -1044,14 +2452,6 @@ public function doCancelRequest($external_event_id, $external_account_id, string ) ?? []); - // path params - if ($external_event_id !== null) { - $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -1104,7 +2504,7 @@ public function doCancelRequest($external_event_id, $external_account_id, string $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1112,40 +2512,40 @@ public function doCancelRequest($external_event_id, $external_account_id, string } /** - * Operation getById + * Operation getDetails * * Get a marketing event * * @param string $external_event_id The id of the marketing event to return (required) * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getById($external_event_id, $external_account_id, string $contentType = self::contentTypes['getById'][0]) + public function getDetails($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - list($response) = $this->getByIdWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->getDetailsWithHttpInfo($external_event_id, $external_account_id, $contentType); return $response; } /** - * Operation getByIdWithHttpInfo + * Operation getDetailsWithHttpInfo * * Get a marketing event * * @param string $external_event_id The id of the marketing event to return (required) * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getById'][0]) + public function getDetailsWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - $request = $this->getByIdRequest($external_event_id, $external_account_id, $contentType); + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1291,20 +2691,20 @@ public function getByIdWithHttpInfo($external_event_id, $external_account_id, st } /** - * Operation getByIdAsync + * Operation getDetailsAsync * * Get a marketing event * * @param string $external_event_id The id of the marketing event to return (required) * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getById'][0]) + public function getDetailsAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - return $this->getByIdAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1313,21 +2713,21 @@ function ($response) { } /** - * Operation getByIdAsyncWithHttpInfo + * Operation getDetailsAsyncWithHttpInfo * * Get a marketing event * * @param string $external_event_id The id of the marketing event to return (required) * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getById'][0]) + public function getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; - $request = $this->getByIdRequest($external_event_id, $external_account_id, $contentType); + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1366,29 +2766,29 @@ function ($exception) { } /** - * Create request for operation 'getById' + * Create request for operation 'getDetails' * * @param string $external_event_id The id of the marketing event to return (required) * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getById'][0]) + public function getDetailsRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling getById' + 'Missing the required parameter $external_event_id when calling getDetails' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling getById' + 'Missing the required parameter $external_account_id when calling getDetails' ); } @@ -1479,40 +2879,42 @@ public function getByIdRequest($external_event_id, $external_account_id, string } /** - * Operation replace + * Operation update * - * Create or update a marketing event + * Update a marketing event * - * @param string $external_event_id The id of the marketing event to upsert (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event to update (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function replace($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['replace'][0]) + public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->replaceWithHttpInfo($external_event_id, $marketing_event_create_request_params, $contentType); + list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $response; } /** - * Operation replaceWithHttpInfo + * Operation updateWithHttpInfo * - * Create or update a marketing event + * Update a marketing event * - * @param string $external_event_id The id of the marketing event to upsert (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event to update (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function replaceWithHttpInfo($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['replace'][0]) + public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - $request = $this->replaceRequest($external_event_id, $marketing_event_create_request_params, $contentType); + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -1658,20 +3060,21 @@ public function replaceWithHttpInfo($external_event_id, $marketing_event_create_ } /** - * Operation replaceAsync + * Operation updateAsync * - * Create or update a marketing event + * Update a marketing event * - * @param string $external_event_id The id of the marketing event to upsert (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event to update (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function replaceAsync($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['replace'][0]) + public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - return $this->replaceAsyncWithHttpInfo($external_event_id, $marketing_event_create_request_params, $contentType) + return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -1680,21 +3083,22 @@ function ($response) { } /** - * Operation replaceAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Create or update a marketing event + * Update a marketing event * - * @param string $external_event_id The id of the marketing event to upsert (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event to update (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function replaceAsyncWithHttpInfo($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['replace'][0]) + public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; - $request = $this->replaceRequest($external_event_id, $marketing_event_create_request_params, $contentType); + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1733,29 +3137,37 @@ function ($exception) { } /** - * Create request for operation 'replace' + * Create request for operation 'update' * - * @param string $external_event_id The id of the marketing event to upsert (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params The details of the marketing event to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event to update (required) + * @param string $external_account_id The account id associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function replaceRequest($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['replace'][0]) + public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling replace' + 'Missing the required parameter $external_event_id when calling update' + ); + } + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling update' ); } - // verify the required parameter 'marketing_event_create_request_params' is set - if ($marketing_event_create_request_params === null || (is_array($marketing_event_create_request_params) && count($marketing_event_create_request_params) === 0)) { + // verify the required parameter 'marketing_event_update_request_params' is set + if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_create_request_params when calling replace' + 'Missing the required parameter $marketing_event_update_request_params when calling update' ); } @@ -1767,6 +3179,15 @@ public function replaceRequest($external_event_id, $marketing_event_create_reque $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); // path params @@ -1786,12 +3207,12 @@ public function replaceRequest($external_event_id, $marketing_event_create_reque ); // for model (json/xml) - if (isset($marketing_event_create_request_params)) { + if (isset($marketing_event_update_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); } else { - $httpBody = $marketing_event_create_request_params; + $httpBody = $marketing_event_update_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1836,7 +3257,7 @@ public function replaceRequest($external_event_id, $marketing_event_create_reque $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PUT', + 'PATCH', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1844,42 +3265,40 @@ public function replaceRequest($external_event_id, $marketing_event_create_reque } /** - * Operation update + * Operation upsert * - * Update a marketing event + * Create or update a marketing event * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params The details of the marketing event to update (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function upsert($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) { - list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + list($response) = $this->upsertWithHttpInfo($external_event_id, $marketing_event_create_request_params, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation upsertWithHttpInfo * - * Update a marketing event + * Create or update a marketing event * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params The details of the marketing event to update (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function upsertWithHttpInfo($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) { - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $request = $this->upsertRequest($external_event_id, $marketing_event_create_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -2025,21 +3444,20 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma } /** - * Operation updateAsync + * Operation upsertAsync * - * Update a marketing event + * Create or update a marketing event * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params The details of the marketing event to update (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function upsertAsync($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) { - return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) + return $this->upsertAsyncWithHttpInfo($external_event_id, $marketing_event_create_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -2048,22 +3466,21 @@ function ($response) { } /** - * Operation updateAsyncWithHttpInfo + * Operation upsertAsyncWithHttpInfo * - * Update a marketing event + * Create or update a marketing event * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params The details of the marketing event to update (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function upsertAsyncWithHttpInfo($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $request = $this->upsertRequest($external_event_id, $marketing_event_create_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2102,37 +3519,29 @@ function ($exception) { } /** - * Create request for operation 'update' + * Create request for operation 'upsert' * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params The details of the marketing event to update (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function upsertRequest($external_event_id, $marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling update' - ); - } - - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling update' + 'Missing the required parameter $external_event_id when calling upsert' ); } - // verify the required parameter 'marketing_event_update_request_params' is set - if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { + // verify the required parameter 'marketing_event_create_request_params' is set + if ($marketing_event_create_request_params === null || (is_array($marketing_event_create_request_params) && count($marketing_event_create_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_update_request_params when calling update' + 'Missing the required parameter $marketing_event_create_request_params when calling upsert' ); } @@ -2144,15 +3553,6 @@ public function updateRequest($external_event_id, $external_account_id, $marketi $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params @@ -2172,12 +3572,12 @@ public function updateRequest($external_event_id, $external_account_id, $marketi ); // for model (json/xml) - if (isset($marketing_event_update_request_params)) { + if (isset($marketing_event_create_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); } else { - $httpBody = $marketing_event_update_request_params; + $httpBody = $marketing_event_create_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2222,7 +3622,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', + 'PUT', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/codegen/Marketing/Events/Api/BatchApi.php b/codegen/Marketing/Events/Api/BatchApi.php deleted file mode 100644 index 03c52c18..00000000 --- a/codegen/Marketing/Events/Api/BatchApi.php +++ /dev/null @@ -1,801 +0,0 @@ - [ - 'application/json', - ], - 'doUpsert' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation archive - * - * Delete multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier The details of the marketing events to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\Error - */ - public function archive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) - { - list($response) = $this->archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); - return $response; - } - - /** - * Operation archiveWithHttpInfo - * - * Delete multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier The details of the marketing events to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) - { - $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation archiveAsync - * - * Delete multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier The details of the marketing events to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) - { - return $this->archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation archiveAsyncWithHttpInfo - * - * Delete multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier The details of the marketing events to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'archive' - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier The details of the marketing events to delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function archiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) - { - - // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set - if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling archive' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events/delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_marketing_event_external_unique_identifier)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); - } else { - $httpBody = $batch_input_marketing_event_external_unique_identifier; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation doUpsert - * - * Create or update multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params The details of the marketing events to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsert'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error - */ - public function doUpsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['doUpsert'][0]) - { - list($response) = $this->doUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); - return $response; - } - - /** - * Operation doUpsertWithHttpInfo - * - * Create or update multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params The details of the marketing events to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsert'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['doUpsert'][0]) - { - $request = $this->doUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation doUpsertAsync - * - * Create or update multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params The details of the marketing events to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doUpsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['doUpsert'][0]) - { - return $this->doUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation doUpsertAsyncWithHttpInfo - * - * Create or update multiple marketing events - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params The details of the marketing events to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['doUpsert'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; - $request = $this->doUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'doUpsert' - * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params The details of the marketing events to upsert (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function doUpsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['doUpsert'][0]) - { - - // verify the required parameter 'batch_input_marketing_event_create_request_params' is set - if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling doUpsert' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events/upsert'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_marketing_event_create_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); - } else { - $httpBody = $batch_input_marketing_event_create_request_params; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Marketing/Events/Api/ListAssociationsApi.php b/codegen/Marketing/Events/Api/ListAssociationsApi.php new file mode 100644 index 00000000..83c36717 --- /dev/null +++ b/codegen/Marketing/Events/Api/ListAssociationsApi.php @@ -0,0 +1,1954 @@ + [ + 'application/json', + ], + 'associateByMarketingEventId' => [ + 'application/json', + ], + 'disassociateByExternalAccountAndEventIds' => [ + 'application/json', + ], + 'disassociateByMarketingEventId' => [ + 'application/json', + ], + 'getAllByExternalAccountAndEventIds' => [ + 'application/json', + ], + 'getAllByMarketingEventId' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation associateByExternalAccountAndEventIds + * + * Associate a list with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function associateByExternalAccountAndEventIds($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['associateByExternalAccountAndEventIds'][0]) + { + $this->associateByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, $list_id, $contentType); + } + + /** + * Operation associateByExternalAccountAndEventIdsWithHttpInfo + * + * Associate a list with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function associateByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['associateByExternalAccountAndEventIds'][0]) + { + $request = $this->associateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation associateByExternalAccountAndEventIdsAsync + * + * Associate a list with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associateByExternalAccountAndEventIdsAsync($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['associateByExternalAccountAndEventIds'][0]) + { + return $this->associateByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, $list_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation associateByExternalAccountAndEventIdsAsyncWithHttpInfo + * + * Associate a list with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associateByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['associateByExternalAccountAndEventIds'][0]) + { + $returnType = ''; + $request = $this->associateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $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 'associateByExternalAccountAndEventIds' + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function associateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['associateByExternalAccountAndEventIds'][0]) + { + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling associateByExternalAccountAndEventIds' + ); + } + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling associateByExternalAccountAndEventIds' + ); + } + + // 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 associateByExternalAccountAndEventIds' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists/{listId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($external_account_id !== null) { + $resourcePath = str_replace( + '{' . 'externalAccountId' . '}', + ObjectSerializer::toPathValue($external_account_id), + $resourcePath + ); + } + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // 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 associateByMarketingEventId + * + * Associate a list with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function associateByMarketingEventId($marketing_event_id, $list_id, string $contentType = self::contentTypes['associateByMarketingEventId'][0]) + { + $this->associateByMarketingEventIdWithHttpInfo($marketing_event_id, $list_id, $contentType); + } + + /** + * Operation associateByMarketingEventIdWithHttpInfo + * + * Associate a list with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function associateByMarketingEventIdWithHttpInfo($marketing_event_id, $list_id, string $contentType = self::contentTypes['associateByMarketingEventId'][0]) + { + $request = $this->associateByMarketingEventIdRequest($marketing_event_id, $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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation associateByMarketingEventIdAsync + * + * Associate a list with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associateByMarketingEventIdAsync($marketing_event_id, $list_id, string $contentType = self::contentTypes['associateByMarketingEventId'][0]) + { + return $this->associateByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $list_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation associateByMarketingEventIdAsyncWithHttpInfo + * + * Associate a list with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function associateByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $list_id, string $contentType = self::contentTypes['associateByMarketingEventId'][0]) + { + $returnType = ''; + $request = $this->associateByMarketingEventIdRequest($marketing_event_id, $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 'associateByMarketingEventId' + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['associateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function associateByMarketingEventIdRequest($marketing_event_id, $list_id, string $contentType = self::contentTypes['associateByMarketingEventId'][0]) + { + + // verify the required parameter 'marketing_event_id' is set + if ($marketing_event_id === null || (is_array($marketing_event_id) && count($marketing_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_id when calling associateByMarketingEventId' + ); + } + + // 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 associateByMarketingEventId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists/{listId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($marketing_event_id !== null) { + $resourcePath = str_replace( + '{' . 'marketingEventId' . '}', + ObjectSerializer::toPathValue($marketing_event_id), + $resourcePath + ); + } + // 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 disassociateByExternalAccountAndEventIds + * + * Disassociate a list from a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function disassociateByExternalAccountAndEventIds($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['disassociateByExternalAccountAndEventIds'][0]) + { + $this->disassociateByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, $list_id, $contentType); + } + + /** + * Operation disassociateByExternalAccountAndEventIdsWithHttpInfo + * + * Disassociate a list from a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function disassociateByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['disassociateByExternalAccountAndEventIds'][0]) + { + $request = $this->disassociateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disassociateByExternalAccountAndEventIdsAsync + * + * Disassociate a list from a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disassociateByExternalAccountAndEventIdsAsync($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['disassociateByExternalAccountAndEventIds'][0]) + { + return $this->disassociateByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, $list_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disassociateByExternalAccountAndEventIdsAsyncWithHttpInfo + * + * Disassociate a list from a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disassociateByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['disassociateByExternalAccountAndEventIds'][0]) + { + $returnType = ''; + $request = $this->disassociateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $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 'disassociateByExternalAccountAndEventIds' + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disassociateByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, $list_id, string $contentType = self::contentTypes['disassociateByExternalAccountAndEventIds'][0]) + { + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling disassociateByExternalAccountAndEventIds' + ); + } + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling disassociateByExternalAccountAndEventIds' + ); + } + + // 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 disassociateByExternalAccountAndEventIds' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists/{listId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($external_account_id !== null) { + $resourcePath = str_replace( + '{' . 'externalAccountId' . '}', + ObjectSerializer::toPathValue($external_account_id), + $resourcePath + ); + } + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // 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 disassociateByMarketingEventId + * + * Disassociate a list from a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function disassociateByMarketingEventId($marketing_event_id, $list_id, string $contentType = self::contentTypes['disassociateByMarketingEventId'][0]) + { + $this->disassociateByMarketingEventIdWithHttpInfo($marketing_event_id, $list_id, $contentType); + } + + /** + * Operation disassociateByMarketingEventIdWithHttpInfo + * + * Disassociate a list from a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function disassociateByMarketingEventIdWithHttpInfo($marketing_event_id, $list_id, string $contentType = self::contentTypes['disassociateByMarketingEventId'][0]) + { + $request = $this->disassociateByMarketingEventIdRequest($marketing_event_id, $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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disassociateByMarketingEventIdAsync + * + * Disassociate a list from a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disassociateByMarketingEventIdAsync($marketing_event_id, $list_id, string $contentType = self::contentTypes['disassociateByMarketingEventId'][0]) + { + return $this->disassociateByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $list_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disassociateByMarketingEventIdAsyncWithHttpInfo + * + * Disassociate a list from a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disassociateByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $list_id, string $contentType = self::contentTypes['disassociateByMarketingEventId'][0]) + { + $returnType = ''; + $request = $this->disassociateByMarketingEventIdRequest($marketing_event_id, $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 'disassociateByMarketingEventId' + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $list_id The ILS ID of the list. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disassociateByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disassociateByMarketingEventIdRequest($marketing_event_id, $list_id, string $contentType = self::contentTypes['disassociateByMarketingEventId'][0]) + { + + // verify the required parameter 'marketing_event_id' is set + if ($marketing_event_id === null || (is_array($marketing_event_id) && count($marketing_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_id when calling disassociateByMarketingEventId' + ); + } + + // 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 disassociateByMarketingEventId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists/{listId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($marketing_event_id !== null) { + $resourcePath = str_replace( + '{' . 'marketingEventId' . '}', + ObjectSerializer::toPathValue($marketing_event_id), + $resourcePath + ); + } + // 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 getAllByExternalAccountAndEventIds + * + * Get lists associated with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getAllByExternalAccountAndEventIds($external_account_id, $external_event_id, string $contentType = self::contentTypes['getAllByExternalAccountAndEventIds'][0]) + { + list($response) = $this->getAllByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, $contentType); + return $response; + } + + /** + * Operation getAllByExternalAccountAndEventIdsWithHttpInfo + * + * Get lists associated with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllByExternalAccountAndEventIdsWithHttpInfo($external_account_id, $external_event_id, string $contentType = self::contentTypes['getAllByExternalAccountAndEventIds'][0]) + { + $request = $this->getAllByExternalAccountAndEventIdsRequest($external_account_id, $external_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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllByExternalAccountAndEventIdsAsync + * + * Get lists associated with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllByExternalAccountAndEventIdsAsync($external_account_id, $external_event_id, string $contentType = self::contentTypes['getAllByExternalAccountAndEventIds'][0]) + { + return $this->getAllByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllByExternalAccountAndEventIdsAsyncWithHttpInfo + * + * Get lists associated with a marketing event + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllByExternalAccountAndEventIdsAsyncWithHttpInfo($external_account_id, $external_event_id, string $contentType = self::contentTypes['getAllByExternalAccountAndEventIds'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; + $request = $this->getAllByExternalAccountAndEventIdsRequest($external_account_id, $external_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 'getAllByExternalAccountAndEventIds' + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllByExternalAccountAndEventIdsRequest($external_account_id, $external_event_id, string $contentType = self::contentTypes['getAllByExternalAccountAndEventIds'][0]) + { + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling getAllByExternalAccountAndEventIds' + ); + } + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling getAllByExternalAccountAndEventIds' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($external_account_id !== null) { + $resourcePath = str_replace( + '{' . 'externalAccountId' . '}', + ObjectSerializer::toPathValue($external_account_id), + $resourcePath + ); + } + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_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 getAllByMarketingEventId + * + * Get lists associated with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getAllByMarketingEventId($marketing_event_id, string $contentType = self::contentTypes['getAllByMarketingEventId'][0]) + { + list($response) = $this->getAllByMarketingEventIdWithHttpInfo($marketing_event_id, $contentType); + return $response; + } + + /** + * Operation getAllByMarketingEventIdWithHttpInfo + * + * Get lists associated with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllByMarketingEventIdWithHttpInfo($marketing_event_id, string $contentType = self::contentTypes['getAllByMarketingEventId'][0]) + { + $request = $this->getAllByMarketingEventIdRequest($marketing_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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllByMarketingEventIdAsync + * + * Get lists associated with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllByMarketingEventIdAsync($marketing_event_id, string $contentType = self::contentTypes['getAllByMarketingEventId'][0]) + { + return $this->getAllByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllByMarketingEventIdAsyncWithHttpInfo + * + * Get lists associated with a marketing event + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, string $contentType = self::contentTypes['getAllByMarketingEventId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; + $request = $this->getAllByMarketingEventIdRequest($marketing_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 'getAllByMarketingEventId' + * + * @param string $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllByMarketingEventIdRequest($marketing_event_id, string $contentType = self::contentTypes['getAllByMarketingEventId'][0]) + { + + // verify the required parameter 'marketing_event_id' is set + if ($marketing_event_id === null || (is_array($marketing_event_id) && count($marketing_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_id when calling getAllByMarketingEventId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($marketing_event_id !== null) { + $resourcePath = str_replace( + '{' . 'marketingEventId' . '}', + ObjectSerializer::toPathValue($marketing_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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/MarketingEventsExternalApi.php b/codegen/Marketing/Events/Api/MarketingEventsExternalApi.php deleted file mode 100644 index 42fc56c8..00000000 --- a/codegen/Marketing/Events/Api/MarketingEventsExternalApi.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, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation complete - * - * @param string $external_event_id external_event_id (required) - * @param string $external_account_id external_account_id (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error - */ - public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) - { - list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); - return $response; - } - - /** - * Operation completeWithHttpInfo - * - * @param string $external_event_id (required) - * @param string $external_account_id (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) - { - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation completeAsync - * - * @param string $external_event_id (required) - * @param string $external_account_id (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) - { - return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation completeAsyncWithHttpInfo - * - * @param string $external_event_id (required) - * @param string $external_account_id (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->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 'complete' - * - * @param string $external_event_id (required) - * @param string $external_account_id (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) - { - - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling complete' - ); - } - - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling complete' - ); - } - - // verify the required parameter 'marketing_event_complete_request_params' is set - if ($marketing_event_complete_request_params === null || (is_array($marketing_event_complete_request_params) && count($marketing_event_complete_request_params) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_complete_request_params when calling complete' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($external_event_id !== null) { - $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($marketing_event_complete_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); - } else { - $httpBody = $marketing_event_complete_request_params; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Marketing/Events/Api/ParticipantStateApi.php b/codegen/Marketing/Events/Api/ParticipantStateApi.php new file mode 100644 index 00000000..f2d9a85c --- /dev/null +++ b/codegen/Marketing/Events/Api/ParticipantStateApi.php @@ -0,0 +1,2090 @@ + [ + 'application/json', + ], + 'getParticipationsBreakdownByExternalEventId' => [ + 'application/json', + ], + 'getParticipationsBreakdownByMarketingEventId' => [ + 'application/json', + ], + 'getParticipationsCountersByEventExternalId' => [ + 'application/json', + ], + 'getParticipationsCountersByMarketingEventId' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getParticipationsBreakdownByContactId + * + * Read participations breakdown by Contact identifier + * + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getParticipationsBreakdownByContactId($contact_identifier, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByContactId'][0]) + { + list($response) = $this->getParticipationsBreakdownByContactIdWithHttpInfo($contact_identifier, $state, $limit, $after, $contentType); + return $response; + } + + /** + * Operation getParticipationsBreakdownByContactIdWithHttpInfo + * + * Read participations breakdown by Contact identifier + * + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getParticipationsBreakdownByContactIdWithHttpInfo($contact_identifier, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByContactId'][0]) + { + $request = $this->getParticipationsBreakdownByContactIdRequest($contact_identifier, $state, $limit, $after, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParticipationsBreakdownByContactIdAsync + * + * Read participations breakdown by Contact identifier + * + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByContactIdAsync($contact_identifier, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByContactId'][0]) + { + return $this->getParticipationsBreakdownByContactIdAsyncWithHttpInfo($contact_identifier, $state, $limit, $after, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParticipationsBreakdownByContactIdAsyncWithHttpInfo + * + * Read participations breakdown by Contact identifier + * + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByContactIdAsyncWithHttpInfo($contact_identifier, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByContactId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + $request = $this->getParticipationsBreakdownByContactIdRequest($contact_identifier, $state, $limit, $after, $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 'getParticipationsBreakdownByContactId' + * + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParticipationsBreakdownByContactIdRequest($contact_identifier, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByContactId'][0]) + { + + // verify the required parameter 'contact_identifier' is set + if ($contact_identifier === null || (is_array($contact_identifier) && count($contact_identifier) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contact_identifier when calling getParticipationsBreakdownByContactId' + ); + } + + + + + + $resourcePath = '/marketing/v3/marketing-events/participations/contacts/{contactIdentifier}/breakdown'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // 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( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($contact_identifier !== null) { + $resourcePath = str_replace( + '{' . 'contactIdentifier' . '}', + ObjectSerializer::toPathValue($contact_identifier), + $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 getParticipationsBreakdownByExternalEventId + * + * Read participations breakdown by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getParticipationsBreakdownByExternalEventId($external_account_id, $external_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByExternalEventId'][0]) + { + list($response) = $this->getParticipationsBreakdownByExternalEventIdWithHttpInfo($external_account_id, $external_event_id, $contact_identifier, $state, $limit, $after, $contentType); + return $response; + } + + /** + * Operation getParticipationsBreakdownByExternalEventIdWithHttpInfo + * + * Read participations breakdown by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getParticipationsBreakdownByExternalEventIdWithHttpInfo($external_account_id, $external_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByExternalEventId'][0]) + { + $request = $this->getParticipationsBreakdownByExternalEventIdRequest($external_account_id, $external_event_id, $contact_identifier, $state, $limit, $after, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParticipationsBreakdownByExternalEventIdAsync + * + * Read participations breakdown by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByExternalEventIdAsync($external_account_id, $external_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByExternalEventId'][0]) + { + return $this->getParticipationsBreakdownByExternalEventIdAsyncWithHttpInfo($external_account_id, $external_event_id, $contact_identifier, $state, $limit, $after, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParticipationsBreakdownByExternalEventIdAsyncWithHttpInfo + * + * Read participations breakdown by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByExternalEventIdAsyncWithHttpInfo($external_account_id, $external_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByExternalEventId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + $request = $this->getParticipationsBreakdownByExternalEventIdRequest($external_account_id, $external_event_id, $contact_identifier, $state, $limit, $after, $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 'getParticipationsBreakdownByExternalEventId' + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParticipationsBreakdownByExternalEventIdRequest($external_account_id, $external_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByExternalEventId'][0]) + { + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling getParticipationsBreakdownByExternalEventId' + ); + } + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling getParticipationsBreakdownByExternalEventId' + ); + } + + + + + + + $resourcePath = '/marketing/v3/marketing-events/participations/{externalAccountId}/{externalEventId}/breakdown'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $contact_identifier, + 'contactIdentifier', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // 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( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($external_account_id !== null) { + $resourcePath = str_replace( + '{' . 'externalAccountId' . '}', + ObjectSerializer::toPathValue($external_account_id), + $resourcePath + ); + } + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_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 getParticipationsBreakdownByMarketingEventId + * + * Read participations breakdown by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getParticipationsBreakdownByMarketingEventId($marketing_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByMarketingEventId'][0]) + { + list($response) = $this->getParticipationsBreakdownByMarketingEventIdWithHttpInfo($marketing_event_id, $contact_identifier, $state, $limit, $after, $contentType); + return $response; + } + + /** + * Operation getParticipationsBreakdownByMarketingEventIdWithHttpInfo + * + * Read participations breakdown by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getParticipationsBreakdownByMarketingEventIdWithHttpInfo($marketing_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByMarketingEventId'][0]) + { + $request = $this->getParticipationsBreakdownByMarketingEventIdRequest($marketing_event_id, $contact_identifier, $state, $limit, $after, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParticipationsBreakdownByMarketingEventIdAsync + * + * Read participations breakdown by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByMarketingEventIdAsync($marketing_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByMarketingEventId'][0]) + { + return $this->getParticipationsBreakdownByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $contact_identifier, $state, $limit, $after, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParticipationsBreakdownByMarketingEventIdAsyncWithHttpInfo + * + * Read participations breakdown by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsBreakdownByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByMarketingEventId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; + $request = $this->getParticipationsBreakdownByMarketingEventIdRequest($marketing_event_id, $contact_identifier, $state, $limit, $after, $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 'getParticipationsBreakdownByMarketingEventId' + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParticipationsBreakdownByMarketingEventIdRequest($marketing_event_id, $contact_identifier = null, $state = null, $limit = 10, $after = null, string $contentType = self::contentTypes['getParticipationsBreakdownByMarketingEventId'][0]) + { + + // verify the required parameter 'marketing_event_id' is set + if ($marketing_event_id === null || (is_array($marketing_event_id) && count($marketing_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_id when calling getParticipationsBreakdownByMarketingEventId' + ); + } + + + + + + + $resourcePath = '/marketing/v3/marketing-events/participations/{marketingEventId}/breakdown'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $contact_identifier, + 'contactIdentifier', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // 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( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($marketing_event_id !== null) { + $resourcePath = str_replace( + '{' . 'marketingEventId' . '}', + ObjectSerializer::toPathValue($marketing_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 getParticipationsCountersByEventExternalId + * + * Read participations counters by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByEventExternalId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\AttendanceCounters|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getParticipationsCountersByEventExternalId($external_account_id, $external_event_id, string $contentType = self::contentTypes['getParticipationsCountersByEventExternalId'][0]) + { + list($response) = $this->getParticipationsCountersByEventExternalIdWithHttpInfo($external_account_id, $external_event_id, $contentType); + return $response; + } + + /** + * Operation getParticipationsCountersByEventExternalIdWithHttpInfo + * + * Read participations counters by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByEventExternalId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\AttendanceCounters|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getParticipationsCountersByEventExternalIdWithHttpInfo($external_account_id, $external_event_id, string $contentType = self::contentTypes['getParticipationsCountersByEventExternalId'][0]) + { + $request = $this->getParticipationsCountersByEventExternalIdRequest($external_account_id, $external_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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\AttendanceCounters' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\AttendanceCounters' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParticipationsCountersByEventExternalIdAsync + * + * Read participations counters by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByEventExternalId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsCountersByEventExternalIdAsync($external_account_id, $external_event_id, string $contentType = self::contentTypes['getParticipationsCountersByEventExternalId'][0]) + { + return $this->getParticipationsCountersByEventExternalIdAsyncWithHttpInfo($external_account_id, $external_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParticipationsCountersByEventExternalIdAsyncWithHttpInfo + * + * Read participations counters by Marketing Event external identifier + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByEventExternalId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsCountersByEventExternalIdAsyncWithHttpInfo($external_account_id, $external_event_id, string $contentType = self::contentTypes['getParticipationsCountersByEventExternalId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; + $request = $this->getParticipationsCountersByEventExternalIdRequest($external_account_id, $external_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 'getParticipationsCountersByEventExternalId' + * + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByEventExternalId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParticipationsCountersByEventExternalIdRequest($external_account_id, $external_event_id, string $contentType = self::contentTypes['getParticipationsCountersByEventExternalId'][0]) + { + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_account_id when calling getParticipationsCountersByEventExternalId' + ); + } + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling getParticipationsCountersByEventExternalId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/participations/{externalAccountId}/{externalEventId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($external_account_id !== null) { + $resourcePath = str_replace( + '{' . 'externalAccountId' . '}', + ObjectSerializer::toPathValue($external_account_id), + $resourcePath + ); + } + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_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 getParticipationsCountersByMarketingEventId + * + * Read participations counters by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\AttendanceCounters|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function getParticipationsCountersByMarketingEventId($marketing_event_id, string $contentType = self::contentTypes['getParticipationsCountersByMarketingEventId'][0]) + { + list($response) = $this->getParticipationsCountersByMarketingEventIdWithHttpInfo($marketing_event_id, $contentType); + return $response; + } + + /** + * Operation getParticipationsCountersByMarketingEventIdWithHttpInfo + * + * Read participations counters by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByMarketingEventId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\AttendanceCounters|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getParticipationsCountersByMarketingEventIdWithHttpInfo($marketing_event_id, string $contentType = self::contentTypes['getParticipationsCountersByMarketingEventId'][0]) + { + $request = $this->getParticipationsCountersByMarketingEventIdRequest($marketing_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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\AttendanceCounters' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\AttendanceCounters' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getParticipationsCountersByMarketingEventIdAsync + * + * Read participations counters by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsCountersByMarketingEventIdAsync($marketing_event_id, string $contentType = self::contentTypes['getParticipationsCountersByMarketingEventId'][0]) + { + return $this->getParticipationsCountersByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getParticipationsCountersByMarketingEventIdAsyncWithHttpInfo + * + * Read participations counters by Marketing Event internal identifier + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getParticipationsCountersByMarketingEventIdAsyncWithHttpInfo($marketing_event_id, string $contentType = self::contentTypes['getParticipationsCountersByMarketingEventId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; + $request = $this->getParticipationsCountersByMarketingEventIdRequest($marketing_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 'getParticipationsCountersByMarketingEventId' + * + * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsCountersByMarketingEventId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getParticipationsCountersByMarketingEventIdRequest($marketing_event_id, string $contentType = self::contentTypes['getParticipationsCountersByMarketingEventId'][0]) + { + + // verify the required parameter 'marketing_event_id' is set + if ($marketing_event_id === null || (is_array($marketing_event_id) && count($marketing_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_id when calling getParticipationsCountersByMarketingEventId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/participations/{marketingEventId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($marketing_event_id !== null) { + $resourcePath = str_replace( + '{' . 'marketingEventId' . '}', + ObjectSerializer::toPathValue($marketing_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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/SearchApi.php b/codegen/Marketing/Events/Api/SearchApi.php deleted file mode 100644 index 7502d279..00000000 --- a/codegen/Marketing/Events/Api/SearchApi.php +++ /dev/null @@ -1,490 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation doSearch - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error - */ - public function doSearch($q, string $contentType = self::contentTypes['doSearch'][0]) - { - list($response) = $this->doSearchWithHttpInfo($q, $contentType); - return $response; - } - - /** - * Operation doSearchWithHttpInfo - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doSearchWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) - { - $request = $this->doSearchRequest($q, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation doSearchAsync - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doSearchAsync($q, string $contentType = self::contentTypes['doSearch'][0]) - { - return $this->doSearchAsyncWithHttpInfo($q, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation doSearchAsyncWithHttpInfo - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function doSearchAsyncWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; - $request = $this->doSearchRequest($q, $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 string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function doSearchRequest($q, string $contentType = self::contentTypes['doSearch'][0]) - { - - // verify the required parameter 'q' is set - if ($q === null || (is_array($q) && count($q) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $q when calling doSearch' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events/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 - true // 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()); - } - } - - return $options; - } -} diff --git a/codegen/Marketing/Events/Api/SettingsApi.php b/codegen/Marketing/Events/Api/SettingsApi.php index b0cf6e2a..077079dd 100644 --- a/codegen/Marketing/Events/Api/SettingsApi.php +++ b/codegen/Marketing/Events/Api/SettingsApi.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -71,10 +71,10 @@ class SettingsApi /** @var string[] $contentTypes **/ public const contentTypes = [ - 'create' => [ + 'getAll' => [ 'application/json', ], - 'getAll' => [ + 'update' => [ 'application/json', ], ]; @@ -126,40 +126,38 @@ public function getConfig() } /** - * Operation create + * Operation getAll * - * Update the application settings + * Retrieve the application settings * - * @param int $app_id The id of the application to update the settings for. (required) - * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url The new application settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id The id of the application to retrieve the settings for. (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\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\EventDetailSettings|\HubSpot\Client\Marketing\Events\Model\Error */ - public function create($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['create'][0]) + public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->createWithHttpInfo($app_id, $event_detail_settings_url, $contentType); + list($response) = $this->getAllWithHttpInfo($app_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getAllWithHttpInfo * - * Update the application settings + * Retrieve the application settings * - * @param int $app_id The id of the application to update the settings for. (required) - * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url The new application settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id The id of the application to retrieve the settings for. (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\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\EventDetailSettings|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['create'][0]) + public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->createRequest($app_id, $event_detail_settings_url, $contentType); + $request = $this->getAllRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -305,20 +303,19 @@ public function createWithHttpInfo($app_id, $event_detail_settings_url, string $ } /** - * Operation createAsync + * Operation getAllAsync * - * Update the application settings + * Retrieve the application settings * - * @param int $app_id The id of the application to update the settings for. (required) - * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url The new application settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id The id of the application to retrieve the settings for. (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 createAsync($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['create'][0]) + public function getAllAsync($app_id, string $contentType = self::contentTypes['getAll'][0]) { - return $this->createAsyncWithHttpInfo($app_id, $event_detail_settings_url, $contentType) + return $this->getAllAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -327,21 +324,20 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getAllAsyncWithHttpInfo * - * Update the application settings + * Retrieve the application settings * - * @param int $app_id The id of the application to update the settings for. (required) - * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url The new application settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id The id of the application to retrieve the settings for. (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 createAsyncWithHttpInfo($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['create'][0]) + public function getAllAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\EventDetailSettings'; - $request = $this->createRequest($app_id, $event_detail_settings_url, $contentType); + $request = $this->getAllRequest($app_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -380,29 +376,21 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'getAll' * - * @param int $app_id The id of the application to update the settings for. (required) - * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url The new application settings (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id The id of the application to retrieve the settings for. (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 createRequest($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['create'][0]) + 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 create' - ); - } - - // verify the required parameter 'event_detail_settings_url' is set - if ($event_detail_settings_url === null || (is_array($event_detail_settings_url) && count($event_detail_settings_url) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $event_detail_settings_url when calling create' + 'Missing the required parameter $app_id when calling getAll' ); } @@ -433,14 +421,7 @@ public function createRequest($app_id, $event_detail_settings_url, string $conte ); // for model (json/xml) - 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 = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event_detail_settings_url)); - } else { - $httpBody = $event_detail_settings_url; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -484,7 +465,7 @@ public function createRequest($app_id, $event_detail_settings_url, string $conte $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -492,38 +473,40 @@ public function createRequest($app_id, $event_detail_settings_url, string $conte } /** - * Operation getAll + * Operation update * - * Retrieve the application settings + * Update the application settings * - * @param int $app_id The id of the application to retrieve the settings for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $app_id The id of the application to update the settings for. (required) + * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url event_detail_settings_url (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\EventDetailSettings|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getAll($app_id, string $contentType = self::contentTypes['getAll'][0]) + public function update($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->getAllWithHttpInfo($app_id, $contentType); + list($response) = $this->updateWithHttpInfo($app_id, $event_detail_settings_url, $contentType); return $response; } /** - * Operation getAllWithHttpInfo + * Operation updateWithHttpInfo * - * Retrieve the application settings + * Update the application settings * - * @param int $app_id The id of the application to retrieve the settings for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $app_id The id of the application to update the settings for. (required) + * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\EventDetailSettings|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getAllWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) + public function updateWithHttpInfo($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['update'][0]) { - $request = $this->getAllRequest($app_id, $contentType); + $request = $this->updateRequest($app_id, $event_detail_settings_url, $contentType); try { $options = $this->createHttpClientOption(); @@ -669,19 +652,20 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT } /** - * Operation getAllAsync + * Operation updateAsync * - * Retrieve the application settings + * Update the application settings * - * @param int $app_id The id of the application to retrieve the settings for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $app_id The id of the application to update the settings for. (required) + * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url (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 getAllAsync($app_id, string $contentType = self::contentTypes['getAll'][0]) + public function updateAsync($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['update'][0]) { - return $this->getAllAsyncWithHttpInfo($app_id, $contentType) + return $this->updateAsyncWithHttpInfo($app_id, $event_detail_settings_url, $contentType) ->then( function ($response) { return $response[0]; @@ -690,20 +674,21 @@ function ($response) { } /** - * Operation getAllAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Retrieve the application settings + * Update the application settings * - * @param int $app_id The id of the application to retrieve the settings for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $app_id The id of the application to update the settings for. (required) + * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url (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 getAllAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getAll'][0]) + public function updateAsyncWithHttpInfo($app_id, $event_detail_settings_url, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\EventDetailSettings'; - $request = $this->getAllRequest($app_id, $contentType); + $request = $this->updateRequest($app_id, $event_detail_settings_url, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -742,21 +727,29 @@ function ($exception) { } /** - * Create request for operation 'getAll' + * Create request for operation 'update' * - * @param int $app_id The id of the application to retrieve the settings for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $app_id The id of the application to update the settings for. (required) + * @param \HubSpot\Client\Marketing\Events\Model\EventDetailSettingsUrl $event_detail_settings_url (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 getAllRequest($app_id, string $contentType = self::contentTypes['getAll'][0]) + public function updateRequest($app_id, $event_detail_settings_url, 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 getAll' + 'Missing the required parameter $app_id when calling update' + ); + } + + // verify the required parameter 'event_detail_settings_url' is set + if ($event_detail_settings_url === null || (is_array($event_detail_settings_url) && count($event_detail_settings_url) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_detail_settings_url when calling update' ); } @@ -787,7 +780,14 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ ); // for model (json/xml) - if (count($formParams) > 0) { + 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 = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event_detail_settings_url)); + } else { + $httpBody = $event_detail_settings_url; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -831,7 +831,7 @@ public function getAllRequest($app_id, string $contentType = self::contentTypes[ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php index 2095652b..dd93e748 100644 --- a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -71,10 +71,10 @@ class SubscriberStateChangesApi /** @var string[] $contentTypes **/ public const contentTypes = [ - 'doEmailUpsertById' => [ + 'upsertByContactEmail' => [ 'application/json', ], - 'doUpsertById' => [ + 'upsertByContactId' => [ 'application/json', ], ]; @@ -126,44 +126,44 @@ public function getConfig() } /** - * Operation doEmailUpsertById + * Operation upsertByContactEmail * - * Record + * Record a subscriber state by contact email * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doEmailUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\Error */ - public function doEmailUpsertById($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['doEmailUpsertById'][0]) + public function upsertByContactEmail($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['upsertByContactEmail'][0]) { - list($response) = $this->doEmailUpsertByIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); + list($response) = $this->upsertByContactEmailWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); return $response; } /** - * Operation doEmailUpsertByIdWithHttpInfo + * Operation upsertByContactEmailWithHttpInfo * - * Record + * Record a subscriber state by contact email * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doEmailUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doEmailUpsertByIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['doEmailUpsertById'][0]) + public function upsertByContactEmailWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['upsertByContactEmail'][0]) { - $request = $this->doEmailUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); + $request = $this->upsertByContactEmailRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); try { $options = $this->createHttpClientOption(); @@ -274,22 +274,22 @@ public function doEmailUpsertByIdWithHttpInfo($external_event_id, $subscriber_st } /** - * Operation doEmailUpsertByIdAsync + * Operation upsertByContactEmailAsync * - * Record + * Record a subscriber state by contact email * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doEmailUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doEmailUpsertByIdAsync($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['doEmailUpsertById'][0]) + public function upsertByContactEmailAsync($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['upsertByContactEmail'][0]) { - return $this->doEmailUpsertByIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType) + return $this->upsertByContactEmailAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType) ->then( function ($response) { return $response[0]; @@ -298,23 +298,23 @@ function ($response) { } /** - * Operation doEmailUpsertByIdAsyncWithHttpInfo + * Operation upsertByContactEmailAsyncWithHttpInfo * - * Record + * Record a subscriber state by contact email * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doEmailUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doEmailUpsertByIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['doEmailUpsertById'][0]) + public function upsertByContactEmailAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['upsertByContactEmail'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - $request = $this->doEmailUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); + $request = $this->upsertByContactEmailRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -353,45 +353,45 @@ function ($exception) { } /** - * Create request for operation 'doEmailUpsertById' + * Create request for operation 'upsertByContactEmail' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doEmailUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doEmailUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['doEmailUpsertById'][0]) + public function upsertByContactEmailRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['upsertByContactEmail'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling doEmailUpsertById' + 'Missing the required parameter $external_event_id when calling upsertByContactEmail' ); } // verify the required parameter 'subscriber_state' is set if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling doEmailUpsertById' + 'Missing the required parameter $subscriber_state when calling upsertByContactEmail' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling doEmailUpsertById' + 'Missing the required parameter $external_account_id when calling upsertByContactEmail' ); } // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling doEmailUpsertById' + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling upsertByContactEmail' ); } @@ -497,44 +497,44 @@ public function doEmailUpsertByIdRequest($external_event_id, $subscriber_state, } /** - * Operation doUpsertById + * Operation upsertByContactId * - * Record + * Record a subscriber state by contact ID * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Marketing\Events\Model\Error */ - public function doUpsertById($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['doUpsertById'][0]) + public function upsertByContactId($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['upsertByContactId'][0]) { - list($response) = $this->doUpsertByIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); + list($response) = $this->upsertByContactIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); return $response; } /** - * Operation doUpsertByIdWithHttpInfo + * Operation upsertByContactIdWithHttpInfo * - * Record + * Record a subscriber state by contact ID * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doUpsertByIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['doUpsertById'][0]) + public function upsertByContactIdWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['upsertByContactId'][0]) { - $request = $this->doUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); + $request = $this->upsertByContactIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); try { $options = $this->createHttpClientOption(); @@ -645,22 +645,22 @@ public function doUpsertByIdWithHttpInfo($external_event_id, $subscriber_state, } /** - * Operation doUpsertByIdAsync + * Operation upsertByContactIdAsync * - * Record + * Record a subscriber state by contact ID * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doUpsertByIdAsync($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['doUpsertById'][0]) + public function upsertByContactIdAsync($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['upsertByContactId'][0]) { - return $this->doUpsertByIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType) + return $this->upsertByContactIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType) ->then( function ($response) { return $response[0]; @@ -669,23 +669,23 @@ function ($response) { } /** - * Operation doUpsertByIdAsyncWithHttpInfo + * Operation upsertByContactIdAsyncWithHttpInfo * - * Record + * Record a subscriber state by contact ID * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doUpsertByIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['doUpsertById'][0]) + public function upsertByContactIdAsyncWithHttpInfo($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['upsertByContactId'][0]) { $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - $request = $this->doUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); + $request = $this->upsertByContactIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -724,45 +724,45 @@ function ($exception) { } /** - * Create request for operation 'doUpsertById' + * Create request for operation 'upsertByContactId' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber The details of the contacts to subscribe to the event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doUpsertById'] to see the possible values for this operation + * @param string $external_event_id The ID of the marketing event (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param string $external_account_id The account ID associated with the marketing event (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doUpsertByIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['doUpsertById'][0]) + public function upsertByContactIdRequest($external_event_id, $subscriber_state, $external_account_id, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['upsertByContactId'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling doUpsertById' + 'Missing the required parameter $external_event_id when calling upsertByContactId' ); } // verify the required parameter 'subscriber_state' is set if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling doUpsertById' + 'Missing the required parameter $subscriber_state when calling upsertByContactId' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling doUpsertById' + 'Missing the required parameter $external_account_id when calling upsertByContactId' ); } // verify the required parameter 'batch_input_marketing_event_subscriber' is set if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_subscriber when calling doUpsertById' + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling upsertByContactId' ); } diff --git a/codegen/Marketing/Events/ApiException.php b/codegen/Marketing/Events/ApiException.php index 499c46e2..5cf35c9b 100644 --- a/codegen/Marketing/Events/ApiException.php +++ b/codegen/Marketing/Events/ApiException.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Configuration.php b/codegen/Marketing/Events/Configuration.php index 4216cc52..5b02fa12 100644 --- a/codegen/Marketing/Events/Configuration.php +++ b/codegen/Marketing/Events/Configuration.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/HeaderSelector.php b/codegen/Marketing/Events/HeaderSelector.php index 1657c16f..e9ecfbf1 100644 --- a/codegen/Marketing/Events/HeaderSelector.php +++ b/codegen/Marketing/Events/HeaderSelector.php @@ -12,7 +12,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/AttendanceCounters.php b/codegen/Marketing/Events/Model/AttendanceCounters.php new file mode 100644 index 00000000..ca9a1d83 --- /dev/null +++ b/codegen/Marketing/Events/Model/AttendanceCounters.php @@ -0,0 +1,523 @@ + + */ +class AttendanceCounters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AttendanceCounters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attended' => 'int', + 'registered' => 'int', + 'cancelled' => 'int', + 'no_shows' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attended' => 'int32', + 'registered' => 'int32', + 'cancelled' => 'int32', + 'no_shows' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attended' => false, + 'registered' => false, + 'cancelled' => false, + 'no_shows' => 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 = [ + 'attended' => 'attended', + 'registered' => 'registered', + 'cancelled' => 'cancelled', + 'no_shows' => 'noShows' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attended' => 'setAttended', + 'registered' => 'setRegistered', + 'cancelled' => 'setCancelled', + 'no_shows' => 'setNoShows' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attended' => 'getAttended', + 'registered' => 'getRegistered', + 'cancelled' => 'getCancelled', + 'no_shows' => 'getNoShows' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('attended', $data ?? [], null); + $this->setIfExists('registered', $data ?? [], null); + $this->setIfExists('cancelled', $data ?? [], null); + $this->setIfExists('no_shows', $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['attended'] === null) { + $invalidProperties[] = "'attended' can't be null"; + } + if ($this->container['registered'] === null) { + $invalidProperties[] = "'registered' can't be null"; + } + if ($this->container['cancelled'] === null) { + $invalidProperties[] = "'cancelled' can't be null"; + } + if ($this->container['no_shows'] === null) { + $invalidProperties[] = "'no_shows' 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 attended + * + * @return int + */ + public function getAttended() + { + return $this->container['attended']; + } + + /** + * Sets attended + * + * @param int $attended attended + * + * @return self + */ + public function setAttended($attended) + { + if (is_null($attended)) { + throw new \InvalidArgumentException('non-nullable attended cannot be null'); + } + $this->container['attended'] = $attended; + + return $this; + } + + /** + * Gets registered + * + * @return int + */ + public function getRegistered() + { + return $this->container['registered']; + } + + /** + * Sets registered + * + * @param int $registered registered + * + * @return self + */ + public function setRegistered($registered) + { + if (is_null($registered)) { + throw new \InvalidArgumentException('non-nullable registered cannot be null'); + } + $this->container['registered'] = $registered; + + return $this; + } + + /** + * Gets cancelled + * + * @return int + */ + public function getCancelled() + { + return $this->container['cancelled']; + } + + /** + * Sets cancelled + * + * @param int $cancelled cancelled + * + * @return self + */ + public function setCancelled($cancelled) + { + if (is_null($cancelled)) { + throw new \InvalidArgumentException('non-nullable cancelled cannot be null'); + } + $this->container['cancelled'] = $cancelled; + + return $this; + } + + /** + * Gets no_shows + * + * @return int + */ + public function getNoShows() + { + return $this->container['no_shows']; + } + + /** + * Sets no_shows + * + * @param int $no_shows no_shows + * + * @return self + */ + public function setNoShows($no_shows) + { + if (is_null($no_shows)) { + throw new \InvalidArgumentException('non-nullable no_shows cannot be null'); + } + $this->container['no_shows'] = $no_shows; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php index 09b63850..30920db6 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php index f0b356ff..b0e2ebff 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -35,7 +35,6 @@ * BatchInputMarketingEventEmailSubscriber Class Doc Comment * * @category Class - * @description List of marketing event details to create or update * @package HubSpot\Client\Marketing\Events * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php index 8d53d2bc..cfb6dfe6 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php index 7c1f7162..72d6be3b 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -35,7 +35,6 @@ * BatchInputMarketingEventSubscriber Class Doc Comment * * @category Class - * @description List of HubSpot contacts to subscribe to the marketing event * @package HubSpot\Client\Marketing\Events * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php index a5b9f448..57ebf1bc 100644 --- a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php b/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php index 90cd5d8a..350707ab 100644 --- a/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php b/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php index 8978b418..95d87460 100644 --- a/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php index be1b76e9..8956680a 100644 --- a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php +++ b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php new file mode 100644 index 00000000..aae00c9b --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php @@ -0,0 +1,483 @@ + + */ +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 = [ + 'total' => 'int', + 'paging' => '\HubSpot\Client\Marketing\Events\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Marketing\Events\Model\ParticipationBreakdown[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + '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 = [ + 'total' => 'total', + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + '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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('total', $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['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets 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; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php new file mode 100644 index 00000000..178b064f --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php @@ -0,0 +1,449 @@ + + */ +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 = [ + 'total' => 'int', + 'results' => '\HubSpot\Client\Marketing\Events\Model\PublicList[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total' => 'total', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\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; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/ContactAssociation.php b/codegen/Marketing/Events/Model/ContactAssociation.php new file mode 100644 index 00000000..0e13c250 --- /dev/null +++ b/codegen/Marketing/Events/Model/ContactAssociation.php @@ -0,0 +1,517 @@ + + */ +class ContactAssociation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactAssociation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'firstname' => 'string', + 'contact_id' => 'string', + 'email' => 'string', + 'lastname' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'firstname' => null, + 'contact_id' => null, + 'email' => null, + 'lastname' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'firstname' => false, + 'contact_id' => false, + 'email' => false, + 'lastname' => 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 = [ + 'firstname' => 'firstname', + 'contact_id' => 'contactId', + 'email' => 'email', + 'lastname' => 'lastname' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'firstname' => 'setFirstname', + 'contact_id' => 'setContactId', + 'email' => 'setEmail', + 'lastname' => 'setLastname' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'firstname' => 'getFirstname', + 'contact_id' => 'getContactId', + 'email' => 'getEmail', + 'lastname' => 'getLastname' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('firstname', $data ?? [], null); + $this->setIfExists('contact_id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('lastname', $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['contact_id'] === null) { + $invalidProperties[] = "'contact_id' can't be null"; + } + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' 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 firstname + * + * @return string|null + */ + public function getFirstname() + { + return $this->container['firstname']; + } + + /** + * Sets firstname + * + * @param string|null $firstname firstname + * + * @return self + */ + public function setFirstname($firstname) + { + if (is_null($firstname)) { + throw new \InvalidArgumentException('non-nullable firstname cannot be null'); + } + $this->container['firstname'] = $firstname; + + return $this; + } + + /** + * Gets contact_id + * + * @return string + */ + public function getContactId() + { + return $this->container['contact_id']; + } + + /** + * Sets contact_id + * + * @param string $contact_id contact_id + * + * @return self + */ + public function setContactId($contact_id) + { + if (is_null($contact_id)) { + throw new \InvalidArgumentException('non-nullable contact_id cannot be null'); + } + $this->container['contact_id'] = $contact_id; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets lastname + * + * @return string|null + */ + public function getLastname() + { + return $this->container['lastname']; + } + + /** + * Sets lastname + * + * @param string|null $lastname lastname + * + * @return self + */ + public function setLastname($lastname) + { + if (is_null($lastname)) { + throw new \InvalidArgumentException('non-nullable lastname cannot be null'); + } + $this->container['lastname'] = $lastname; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/Error.php b/codegen/Marketing/Events/Model/Error.php index 749cbfe9..52717870 100644 --- a/codegen/Marketing/Events/Model/Error.php +++ b/codegen/Marketing/Events/Model/Error.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/ErrorDetail.php b/codegen/Marketing/Events/Model/ErrorDetail.php index 9041ca0d..87ca0704 100644 --- a/codegen/Marketing/Events/Model/ErrorDetail.php +++ b/codegen/Marketing/Events/Model/ErrorDetail.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/EventDetailSettings.php b/codegen/Marketing/Events/Model/EventDetailSettings.php index 47759175..9da8c5ec 100644 --- a/codegen/Marketing/Events/Model/EventDetailSettings.php +++ b/codegen/Marketing/Events/Model/EventDetailSettings.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php b/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php index 628293e1..44434496 100644 --- a/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php +++ b/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/ForwardPaging.php b/codegen/Marketing/Events/Model/ForwardPaging.php new file mode 100644 index 00000000..ad774cef --- /dev/null +++ b/codegen/Marketing/Events/Model/ForwardPaging.php @@ -0,0 +1,409 @@ + + */ +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\Events\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[] $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\Events\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Marketing\Events\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 $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventAssociation.php b/codegen/Marketing/Events/Model/MarketingEventAssociation.php new file mode 100644 index 00000000..611df3db --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventAssociation.php @@ -0,0 +1,517 @@ + + */ +class MarketingEventAssociation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventAssociation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_account_id' => 'string', + 'marketing_event_id' => 'string', + 'external_event_id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_account_id' => null, + 'marketing_event_id' => null, + 'external_event_id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_account_id' => false, + 'marketing_event_id' => false, + 'external_event_id' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_account_id' => 'externalAccountId', + 'marketing_event_id' => 'marketingEventId', + 'external_event_id' => 'externalEventId', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_account_id' => 'setExternalAccountId', + 'marketing_event_id' => 'setMarketingEventId', + 'external_event_id' => 'setExternalEventId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_account_id' => 'getExternalAccountId', + 'marketing_event_id' => 'getMarketingEventId', + 'external_event_id' => 'getExternalEventId', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('external_account_id', $data ?? [], null); + $this->setIfExists('marketing_event_id', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['marketing_event_id'] === null) { + $invalidProperties[] = "'marketing_event_id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_account_id + * + * @return string|null + */ + public function getExternalAccountId() + { + return $this->container['external_account_id']; + } + + /** + * Sets external_account_id + * + * @param string|null $external_account_id external_account_id + * + * @return self + */ + public function setExternalAccountId($external_account_id) + { + if (is_null($external_account_id)) { + throw new \InvalidArgumentException('non-nullable external_account_id cannot be null'); + } + $this->container['external_account_id'] = $external_account_id; + + return $this; + } + + /** + * Gets marketing_event_id + * + * @return string + */ + public function getMarketingEventId() + { + return $this->container['marketing_event_id']; + } + + /** + * Sets marketing_event_id + * + * @param string $marketing_event_id marketing_event_id + * + * @return self + */ + public function setMarketingEventId($marketing_event_id) + { + if (is_null($marketing_event_id)) { + throw new \InvalidArgumentException('non-nullable marketing_event_id cannot be null'); + } + $this->container['marketing_event_id'] = $marketing_event_id; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string|null + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string|null $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php index da957f5e..93def327 100644 --- a/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php index 660c29c9..47348687 100644 --- a/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -67,6 +67,7 @@ class MarketingEventCreateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => 'string', 'event_name' => 'string', 'event_type' => 'string', + 'event_completed' => 'bool', 'end_date_time' => '\DateTime' ]; @@ -88,6 +89,7 @@ class MarketingEventCreateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => null, 'event_name' => null, 'event_type' => null, + 'event_completed' => null, 'end_date_time' => 'date-time' ]; @@ -107,6 +109,7 @@ class MarketingEventCreateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => false, 'event_name' => false, 'event_type' => false, + 'event_completed' => false, 'end_date_time' => false ]; @@ -206,6 +209,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', 'end_date_time' => 'endDateTime' ]; @@ -225,6 +229,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', 'end_date_time' => 'setEndDateTime' ]; @@ -244,6 +249,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', 'end_date_time' => 'getEndDateTime' ]; @@ -314,6 +320,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); } @@ -641,6 +648,33 @@ public function setEventType($event_type) return $this; } + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + /** * Gets end_date_time * diff --git a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php index 233f6470..6b89ec80 100644 --- a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -65,6 +65,7 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_description' => 'string', 'event_name' => 'string', 'event_type' => 'string', + 'event_completed' => 'bool', 'end_date_time' => '\DateTime' ]; @@ -84,6 +85,7 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_description' => null, 'event_name' => null, 'event_type' => null, + 'event_completed' => null, 'end_date_time' => 'date-time' ]; @@ -101,6 +103,7 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_description' => false, 'event_name' => false, 'event_type' => false, + 'event_completed' => false, 'end_date_time' => false ]; @@ -198,6 +201,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', 'end_date_time' => 'endDateTime' ]; @@ -215,6 +219,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', 'end_date_time' => 'setEndDateTime' ]; @@ -232,6 +237,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', 'end_date_time' => 'getEndDateTime' ]; @@ -300,6 +306,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); } @@ -567,6 +574,33 @@ public function setEventType($event_type) return $this; } + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + /** * Gets end_date_time * diff --git a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php index cb976c84..6fe365ec 100644 --- a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php b/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php index eb4f2005..9e970aa8 100644 --- a/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php +++ b/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php index 80ee82cc..3ca1d7c7 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -57,17 +57,18 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess * @var string[] */ protected static $openAPITypes = [ + 'event_organizer' => 'string', + 'event_url' => 'string', + 'event_type' => 'string', + 'event_completed' => 'bool', + 'end_date_time' => '\DateTime', 'created_at' => '\DateTime', 'start_date_time' => '\DateTime', 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\PropertyValue[]', 'event_cancelled' => 'bool', - 'event_organizer' => 'string', - 'event_url' => 'string', 'event_description' => 'string', 'event_name' => 'string', - 'event_type' => 'string', 'id' => 'string', - 'end_date_time' => '\DateTime', 'updated_at' => '\DateTime' ]; @@ -79,17 +80,18 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess * @psalm-var array */ protected static $openAPIFormats = [ + 'event_organizer' => null, + 'event_url' => null, + 'event_type' => null, + 'event_completed' => null, + 'end_date_time' => 'date-time', 'created_at' => 'date-time', 'start_date_time' => 'date-time', 'custom_properties' => null, 'event_cancelled' => null, - 'event_organizer' => null, - 'event_url' => null, 'event_description' => null, 'event_name' => null, - 'event_type' => null, 'id' => null, - 'end_date_time' => 'date-time', 'updated_at' => 'date-time' ]; @@ -99,17 +101,18 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess * @var boolean[] */ protected static array $openAPINullables = [ + 'event_organizer' => false, + 'event_url' => false, + 'event_type' => false, + 'event_completed' => false, + 'end_date_time' => false, 'created_at' => false, 'start_date_time' => false, 'custom_properties' => false, 'event_cancelled' => false, - 'event_organizer' => false, - 'event_url' => false, 'event_description' => false, 'event_name' => false, - 'event_type' => false, 'id' => false, - 'end_date_time' => false, 'updated_at' => false ]; @@ -199,17 +202,18 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', + 'end_date_time' => 'endDateTime', 'created_at' => 'createdAt', 'start_date_time' => 'startDateTime', 'custom_properties' => 'customProperties', 'event_cancelled' => 'eventCancelled', - 'event_organizer' => 'eventOrganizer', - 'event_url' => 'eventUrl', 'event_description' => 'eventDescription', 'event_name' => 'eventName', - 'event_type' => 'eventType', 'id' => 'id', - 'end_date_time' => 'endDateTime', 'updated_at' => 'updatedAt' ]; @@ -219,17 +223,18 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', + 'end_date_time' => 'setEndDateTime', 'created_at' => 'setCreatedAt', 'start_date_time' => 'setStartDateTime', 'custom_properties' => 'setCustomProperties', 'event_cancelled' => 'setEventCancelled', - 'event_organizer' => 'setEventOrganizer', - 'event_url' => 'setEventUrl', 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', - 'event_type' => 'setEventType', 'id' => 'setId', - 'end_date_time' => 'setEndDateTime', 'updated_at' => 'setUpdatedAt' ]; @@ -239,17 +244,18 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', + 'end_date_time' => 'getEndDateTime', 'created_at' => 'getCreatedAt', 'start_date_time' => 'getStartDateTime', 'custom_properties' => 'getCustomProperties', 'event_cancelled' => 'getEventCancelled', - 'event_organizer' => 'getEventOrganizer', - 'event_url' => 'getEventUrl', 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', - 'event_type' => 'getEventType', 'id' => 'getId', - 'end_date_time' => 'getEndDateTime', 'updated_at' => 'getUpdatedAt' ]; @@ -310,17 +316,18 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('start_date_time', $data ?? [], null); $this->setIfExists('custom_properties', $data ?? [], null); $this->setIfExists('event_cancelled', $data ?? [], null); - $this->setIfExists('event_organizer', $data ?? [], null); - $this->setIfExists('event_url', $data ?? [], null); $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); - $this->setIfExists('event_type', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('end_date_time', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -351,12 +358,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['created_at'] === null) { - $invalidProperties[] = "'created_at' can't be null"; - } if ($this->container['event_organizer'] === null) { $invalidProperties[] = "'event_organizer' can't be null"; } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } if ($this->container['event_name'] === null) { $invalidProperties[] = "'event_name' can't be null"; } @@ -382,298 +389,325 @@ public function valid() /** - * Gets created_at + * Gets event_organizer * - * @return \DateTime + * @return string */ - public function getCreatedAt() + public function getEventOrganizer() { - return $this->container['created_at']; + return $this->container['event_organizer']; } /** - * Sets created_at + * Sets event_organizer * - * @param \DateTime $created_at + * @param string $event_organizer The name of the organizer of the marketing event. * * @return self */ - public function setCreatedAt($created_at) + public function setEventOrganizer($event_organizer) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['event_organizer'] = $event_organizer; return $this; } /** - * Gets start_date_time + * Gets event_url * - * @return \DateTime|null + * @return string|null */ - public function getStartDateTime() + public function getEventUrl() { - return $this->container['start_date_time']; + return $this->container['event_url']; } /** - * Sets start_date_time + * Sets event_url * - * @param \DateTime|null $start_date_time The start date and time of the marketing event. + * @param string|null $event_url A URL in the external event application where the marketing event can be managed. * * @return self */ - public function setStartDateTime($start_date_time) + public function setEventUrl($event_url) { - if (is_null($start_date_time)) { - throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); } - $this->container['start_date_time'] = $start_date_time; + $this->container['event_url'] = $event_url; return $this; } /** - * Gets custom_properties + * Gets event_type * - * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[]|null + * @return string|null */ - public function getCustomProperties() + public function getEventType() { - return $this->container['custom_properties']; + return $this->container['event_type']; } /** - * Sets custom_properties + * Sets event_type * - * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[]|null $custom_properties A list of PropertyValues. These can be whatever kind of property names and values you want. However, they must already exist on the HubSpot account's definition of the MarketingEvent Object. If they don't they will be filtered out and not set. In order to do this you'll need to create a new PropertyGroup on the HubSpot account's MarketingEvent object for your specific app and create the Custom Property you want to track on that HubSpot account. Do not create any new default properties on the MarketingEvent object as that will apply to all HubSpot accounts. + * @param string|null $event_type The type of the marketing event. * * @return self */ - public function setCustomProperties($custom_properties) + public function setEventType($event_type) { - if (is_null($custom_properties)) { - throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); } - $this->container['custom_properties'] = $custom_properties; + $this->container['event_type'] = $event_type; return $this; } /** - * Gets event_cancelled + * Gets event_completed * * @return bool|null */ - public function getEventCancelled() + public function getEventCompleted() { - return $this->container['event_cancelled']; + return $this->container['event_completed']; } /** - * Sets event_cancelled + * Sets event_completed * - * @param bool|null $event_cancelled Indicates if the marketing event has been cancelled. + * @param bool|null $event_completed event_completed * * @return self */ - public function setEventCancelled($event_cancelled) + public function setEventCompleted($event_completed) { - if (is_null($event_cancelled)) { - throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); } - $this->container['event_cancelled'] = $event_cancelled; + $this->container['event_completed'] = $event_completed; return $this; } /** - * Gets event_organizer + * Gets end_date_time * - * @return string + * @return \DateTime|null */ - public function getEventOrganizer() + public function getEndDateTime() { - return $this->container['event_organizer']; + return $this->container['end_date_time']; } /** - * Sets event_organizer + * Sets end_date_time * - * @param string $event_organizer The name of the organizer of the marketing event. + * @param \DateTime|null $end_date_time The end date and time of the marketing event. * * @return self */ - public function setEventOrganizer($event_organizer) + public function setEndDateTime($end_date_time) { - if (is_null($event_organizer)) { - throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); } - $this->container['event_organizer'] = $event_organizer; + $this->container['end_date_time'] = $end_date_time; return $this; } /** - * Gets event_url + * Gets created_at * - * @return string|null + * @return \DateTime */ - public function getEventUrl() + public function getCreatedAt() { - return $this->container['event_url']; + return $this->container['created_at']; } /** - * Sets event_url + * Sets created_at * - * @param string|null $event_url A URL in the external event application where the marketing event can be managed. + * @param \DateTime $created_at * * @return self */ - public function setEventUrl($event_url) + public function setCreatedAt($created_at) { - if (is_null($event_url)) { - throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['event_url'] = $event_url; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets event_description + * Gets start_date_time * - * @return string|null + * @return \DateTime|null */ - public function getEventDescription() + public function getStartDateTime() { - return $this->container['event_description']; + return $this->container['start_date_time']; } /** - * Sets event_description + * Sets start_date_time * - * @param string|null $event_description The description of the marketing event. + * @param \DateTime|null $start_date_time The start date and time of the marketing event. * * @return self */ - public function setEventDescription($event_description) + public function setStartDateTime($start_date_time) { - if (is_null($event_description)) { - throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); } - $this->container['event_description'] = $event_description; + $this->container['start_date_time'] = $start_date_time; return $this; } /** - * Gets event_name + * Gets custom_properties * - * @return string + * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[]|null */ - public function getEventName() + public function getCustomProperties() { - return $this->container['event_name']; + return $this->container['custom_properties']; } /** - * Sets event_name + * Sets custom_properties * - * @param string $event_name The name of the marketing event. + * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[]|null $custom_properties A list of PropertyValues. These can be whatever kind of property names and values you want. However, they must already exist on the HubSpot account's definition of the MarketingEvent Object. If they don't they will be filtered out and not set. In order to do this you'll need to create a new PropertyGroup on the HubSpot account's MarketingEvent object for your specific app and create the Custom Property you want to track on that HubSpot account. Do not create any new default properties on the MarketingEvent object as that will apply to all HubSpot accounts. * * @return self */ - public function setEventName($event_name) + public function setCustomProperties($custom_properties) { - if (is_null($event_name)) { - throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); } - $this->container['event_name'] = $event_name; + $this->container['custom_properties'] = $custom_properties; return $this; } /** - * Gets event_type + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled Indicates if the marketing event has been cancelled. + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_description * * @return string|null */ - public function getEventType() + public function getEventDescription() { - return $this->container['event_type']; + return $this->container['event_description']; } /** - * Sets event_type + * Sets event_description * - * @param string|null $event_type The type of the marketing event. + * @param string|null $event_description The description of the marketing event. * * @return self */ - public function setEventType($event_type) + public function setEventDescription($event_description) { - if (is_null($event_type)) { - throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); } - $this->container['event_type'] = $event_type; + $this->container['event_description'] = $event_description; return $this; } /** - * Gets id + * Gets event_name * * @return string */ - public function getId() + public function getEventName() { - return $this->container['id']; + return $this->container['event_name']; } /** - * Sets id + * Sets event_name * - * @param string $id + * @param string $event_name The name of the marketing event. * * @return self */ - public function setId($id) + public function setEventName($event_name) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); } - $this->container['id'] = $id; + $this->container['event_name'] = $event_name; return $this; } /** - * Gets end_date_time + * Gets id * - * @return \DateTime|null + * @return string */ - public function getEndDateTime() + public function getId() { - return $this->container['end_date_time']; + return $this->container['id']; } /** - * Sets end_date_time + * Sets id * - * @param \DateTime|null $end_date_time The end date and time of the marketing event. + * @param string $id * * @return self */ - public function setEndDateTime($end_date_time) + public function setId($id) { - if (is_null($end_date_time)) { - throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['end_date_time'] = $end_date_time; + $this->container['id'] = $id; return $this; } diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php index 87de5397..8d583b15 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -62,6 +62,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_url' => 'string', 'attendees' => 'int', 'event_type' => 'string', + 'event_completed' => 'bool', 'end_date_time' => '\DateTime', 'no_shows' => 'int', 'cancellations' => 'int', @@ -89,6 +90,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_url' => null, 'attendees' => 'int32', 'event_type' => null, + 'event_completed' => null, 'end_date_time' => 'date-time', 'no_shows' => 'int32', 'cancellations' => 'int32', @@ -114,6 +116,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_url' => false, 'attendees' => false, 'event_type' => false, + 'event_completed' => false, 'end_date_time' => false, 'no_shows' => false, 'cancellations' => false, @@ -219,6 +222,7 @@ public function isNullableSetToNull(string $property): bool 'event_url' => 'eventUrl', 'attendees' => 'attendees', 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', 'end_date_time' => 'endDateTime', 'no_shows' => 'noShows', 'cancellations' => 'cancellations', @@ -244,6 +248,7 @@ public function isNullableSetToNull(string $property): bool 'event_url' => 'setEventUrl', 'attendees' => 'setAttendees', 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', 'end_date_time' => 'setEndDateTime', 'no_shows' => 'setNoShows', 'cancellations' => 'setCancellations', @@ -269,6 +274,7 @@ public function isNullableSetToNull(string $property): bool 'event_url' => 'getEventUrl', 'attendees' => 'getAttendees', 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', 'end_date_time' => 'getEndDateTime', 'no_shows' => 'getNoShows', 'cancellations' => 'getCancellations', @@ -345,6 +351,7 @@ public function __construct(array $data = null) $this->setIfExists('event_url', $data ?? [], null); $this->setIfExists('attendees', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); $this->setIfExists('no_shows', $data ?? [], null); $this->setIfExists('cancellations', $data ?? [], null); @@ -566,6 +573,33 @@ public function setEventType($event_type) return $this; } + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + /** * Gets end_date_time * diff --git a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php index c65cb635..c1c989c1 100644 --- a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php index a9dd5196..e974bae6 100644 --- a/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -65,6 +65,7 @@ class MarketingEventUpdateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => 'string', 'event_name' => 'string', 'event_type' => 'string', + 'event_completed' => 'bool', 'end_date_time' => '\DateTime' ]; @@ -84,6 +85,7 @@ class MarketingEventUpdateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => null, 'event_name' => null, 'event_type' => null, + 'event_completed' => null, 'end_date_time' => 'date-time' ]; @@ -101,6 +103,7 @@ class MarketingEventUpdateRequestParams implements ModelInterface, ArrayAccess, 'event_description' => false, 'event_name' => false, 'event_type' => false, + 'event_completed' => false, 'end_date_time' => false ]; @@ -198,6 +201,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', 'end_date_time' => 'endDateTime' ]; @@ -215,6 +219,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', 'end_date_time' => 'setEndDateTime' ]; @@ -232,6 +237,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', 'end_date_time' => 'getEndDateTime' ]; @@ -300,6 +306,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); } @@ -561,6 +568,33 @@ public function setEventType($event_type) return $this; } + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + /** * Gets end_date_time * diff --git a/codegen/Marketing/Events/Model/ModelInterface.php b/codegen/Marketing/Events/Model/ModelInterface.php index 5c035e04..59e6c9b6 100644 --- a/codegen/Marketing/Events/Model/ModelInterface.php +++ b/codegen/Marketing/Events/Model/ModelInterface.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/NextPage.php b/codegen/Marketing/Events/Model/NextPage.php new file mode 100644 index 00000000..bb9111cc --- /dev/null +++ b/codegen/Marketing/Events/Model/NextPage.php @@ -0,0 +1,446 @@ + + */ +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 = [ + 'link' => 'string', + 'after' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'link' => null, + 'after' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => 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 = [ + 'link' => 'link', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'link' => 'setLink', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'link' => 'getLink', + 'after' => 'getAfter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $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 link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link link + * + * @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; + } + + /** + * Gets after + * + * @return string + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string $after after + * + * @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; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/ParticipationAssociations.php b/codegen/Marketing/Events/Model/ParticipationAssociations.php new file mode 100644 index 00000000..1b111587 --- /dev/null +++ b/codegen/Marketing/Events/Model/ParticipationAssociations.php @@ -0,0 +1,449 @@ + + */ +class ParticipationAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParticipationAssociations'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'marketing_event' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventAssociation', + 'contact' => '\HubSpot\Client\Marketing\Events\Model\ContactAssociation' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'marketing_event' => null, + 'contact' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'marketing_event' => false, + 'contact' => 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 = [ + 'marketing_event' => 'marketingEvent', + 'contact' => 'contact' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'marketing_event' => 'setMarketingEvent', + 'contact' => 'setContact' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'marketing_event' => 'getMarketingEvent', + 'contact' => 'getContact' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('marketing_event', $data ?? [], null); + $this->setIfExists('contact', $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['marketing_event'] === null) { + $invalidProperties[] = "'marketing_event' can't be null"; + } + if ($this->container['contact'] === null) { + $invalidProperties[] = "'contact' 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 marketing_event + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventAssociation + */ + public function getMarketingEvent() + { + return $this->container['marketing_event']; + } + + /** + * Sets marketing_event + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventAssociation $marketing_event marketing_event + * + * @return self + */ + public function setMarketingEvent($marketing_event) + { + if (is_null($marketing_event)) { + throw new \InvalidArgumentException('non-nullable marketing_event cannot be null'); + } + $this->container['marketing_event'] = $marketing_event; + + return $this; + } + + /** + * Gets contact + * + * @return \HubSpot\Client\Marketing\Events\Model\ContactAssociation + */ + public function getContact() + { + return $this->container['contact']; + } + + /** + * Sets contact + * + * @param \HubSpot\Client\Marketing\Events\Model\ContactAssociation $contact contact + * + * @return self + */ + public function setContact($contact) + { + if (is_null($contact)) { + throw new \InvalidArgumentException('non-nullable contact cannot be null'); + } + $this->container['contact'] = $contact; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/ParticipationBreakdown.php b/codegen/Marketing/Events/Model/ParticipationBreakdown.php new file mode 100644 index 00000000..4ae136f1 --- /dev/null +++ b/codegen/Marketing/Events/Model/ParticipationBreakdown.php @@ -0,0 +1,523 @@ + + */ +class ParticipationBreakdown implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParticipationBreakdown'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Marketing\Events\Model\ParticipationAssociations', + 'created_at' => '\DateTime', + 'id' => 'string', + 'properties' => '\HubSpot\Client\Marketing\Events\Model\ParticipationProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'created_at' => 'date-time', + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'created_at' => 'createdAt', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'created_at' => 'setCreatedAt', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'created_at' => 'getCreatedAt', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['associations'] === null) { + $invalidProperties[] = "'associations' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Marketing\Events\Model\ParticipationAssociations + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Marketing\Events\Model\ParticipationAssociations $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return \HubSpot\Client\Marketing\Events\Model\ParticipationProperties + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param \HubSpot\Client\Marketing\Events\Model\ParticipationProperties $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/ParticipationProperties.php b/codegen/Marketing/Events/Model/ParticipationProperties.php new file mode 100644 index 00000000..1d12c986 --- /dev/null +++ b/codegen/Marketing/Events/Model/ParticipationProperties.php @@ -0,0 +1,557 @@ + + */ +class ParticipationProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParticipationProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'occurred_at' => 'int', + 'attendance_percentage' => 'string', + 'attendance_state' => 'string', + 'attendance_duration_seconds' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'occurred_at' => 'int64', + 'attendance_percentage' => null, + 'attendance_state' => null, + 'attendance_duration_seconds' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'occurred_at' => false, + 'attendance_percentage' => false, + 'attendance_state' => false, + 'attendance_duration_seconds' => 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 = [ + 'occurred_at' => 'occurredAt', + 'attendance_percentage' => 'attendancePercentage', + 'attendance_state' => 'attendanceState', + 'attendance_duration_seconds' => 'attendanceDurationSeconds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'occurred_at' => 'setOccurredAt', + 'attendance_percentage' => 'setAttendancePercentage', + 'attendance_state' => 'setAttendanceState', + 'attendance_duration_seconds' => 'setAttendanceDurationSeconds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'occurred_at' => 'getOccurredAt', + 'attendance_percentage' => 'getAttendancePercentage', + 'attendance_state' => 'getAttendanceState', + 'attendance_duration_seconds' => 'getAttendanceDurationSeconds' + ]; + + /** + * 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 ATTENDANCE_STATE_REGISTERED = 'REGISTERED'; + public const ATTENDANCE_STATE_ATTENDED = 'ATTENDED'; + public const ATTENDANCE_STATE_CANCELLED = 'CANCELLED'; + public const ATTENDANCE_STATE__EMPTY = 'EMPTY'; + public const ATTENDANCE_STATE_NO_SHOW = 'NO_SHOW'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAttendanceStateAllowableValues() + { + return [ + self::ATTENDANCE_STATE_REGISTERED, + self::ATTENDANCE_STATE_ATTENDED, + self::ATTENDANCE_STATE_CANCELLED, + self::ATTENDANCE_STATE__EMPTY, + self::ATTENDANCE_STATE_NO_SHOW, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('occurred_at', $data ?? [], null); + $this->setIfExists('attendance_percentage', $data ?? [], null); + $this->setIfExists('attendance_state', $data ?? [], null); + $this->setIfExists('attendance_duration_seconds', $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['occurred_at'] === null) { + $invalidProperties[] = "'occurred_at' can't be null"; + } + if ($this->container['attendance_state'] === null) { + $invalidProperties[] = "'attendance_state' can't be null"; + } + $allowedValues = $this->getAttendanceStateAllowableValues(); + if (!is_null($this->container['attendance_state']) && !in_array($this->container['attendance_state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'attendance_state', must be one of '%s'", + $this->container['attendance_state'], + 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 occurred_at + * + * @return int + */ + public function getOccurredAt() + { + return $this->container['occurred_at']; + } + + /** + * Sets occurred_at + * + * @param int $occurred_at occurred_at + * + * @return self + */ + public function setOccurredAt($occurred_at) + { + if (is_null($occurred_at)) { + throw new \InvalidArgumentException('non-nullable occurred_at cannot be null'); + } + $this->container['occurred_at'] = $occurred_at; + + return $this; + } + + /** + * Gets attendance_percentage + * + * @return string|null + */ + public function getAttendancePercentage() + { + return $this->container['attendance_percentage']; + } + + /** + * Sets attendance_percentage + * + * @param string|null $attendance_percentage attendance_percentage + * + * @return self + */ + public function setAttendancePercentage($attendance_percentage) + { + if (is_null($attendance_percentage)) { + throw new \InvalidArgumentException('non-nullable attendance_percentage cannot be null'); + } + $this->container['attendance_percentage'] = $attendance_percentage; + + return $this; + } + + /** + * Gets attendance_state + * + * @return string + */ + public function getAttendanceState() + { + return $this->container['attendance_state']; + } + + /** + * Sets attendance_state + * + * @param string $attendance_state attendance_state + * + * @return self + */ + public function setAttendanceState($attendance_state) + { + if (is_null($attendance_state)) { + throw new \InvalidArgumentException('non-nullable attendance_state cannot be null'); + } + $allowedValues = $this->getAttendanceStateAllowableValues(); + if (!in_array($attendance_state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'attendance_state', must be one of '%s'", + $attendance_state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['attendance_state'] = $attendance_state; + + return $this; + } + + /** + * Gets attendance_duration_seconds + * + * @return int|null + */ + public function getAttendanceDurationSeconds() + { + return $this->container['attendance_duration_seconds']; + } + + /** + * Sets attendance_duration_seconds + * + * @param int|null $attendance_duration_seconds attendance_duration_seconds + * + * @return self + */ + public function setAttendanceDurationSeconds($attendance_duration_seconds) + { + if (is_null($attendance_duration_seconds)) { + throw new \InvalidArgumentException('non-nullable attendance_duration_seconds cannot be null'); + } + $this->container['attendance_duration_seconds'] = $attendance_duration_seconds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/PropertyValue.php b/codegen/Marketing/Events/Model/PropertyValue.php index 0fcfb7f8..2e8b0ac7 100644 --- a/codegen/Marketing/Events/Model/PropertyValue.php +++ b/codegen/Marketing/Events/Model/PropertyValue.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech @@ -64,8 +64,11 @@ class PropertyValue implements ModelInterface, ArrayAccess, \JsonSerializable 'updated_by_user_id' => 'int', 'persistence_timestamp' => 'int', 'source_metadata' => 'string', + 'data_sensitivity' => 'string', 'source_vid' => 'int[]', + 'unit' => 'string', 'request_id' => 'string', + 'is_encrypted' => 'bool', 'name' => 'string', 'use_timestamp_as_persistence_timestamp' => 'bool', 'value' => 'string', @@ -89,8 +92,11 @@ class PropertyValue implements ModelInterface, ArrayAccess, \JsonSerializable 'updated_by_user_id' => 'int32', 'persistence_timestamp' => 'int64', 'source_metadata' => null, + 'data_sensitivity' => null, 'source_vid' => 'int64', + 'unit' => null, 'request_id' => null, + 'is_encrypted' => null, 'name' => null, 'use_timestamp_as_persistence_timestamp' => null, 'value' => null, @@ -112,8 +118,11 @@ class PropertyValue implements ModelInterface, ArrayAccess, \JsonSerializable 'updated_by_user_id' => false, 'persistence_timestamp' => false, 'source_metadata' => false, + 'data_sensitivity' => false, 'source_vid' => false, + 'unit' => false, 'request_id' => false, + 'is_encrypted' => false, 'name' => false, 'use_timestamp_as_persistence_timestamp' => false, 'value' => false, @@ -215,8 +224,11 @@ public function isNullableSetToNull(string $property): bool 'updated_by_user_id' => 'updatedByUserId', 'persistence_timestamp' => 'persistenceTimestamp', 'source_metadata' => 'sourceMetadata', + 'data_sensitivity' => 'dataSensitivity', 'source_vid' => 'sourceVid', + 'unit' => 'unit', 'request_id' => 'requestId', + 'is_encrypted' => 'isEncrypted', 'name' => 'name', 'use_timestamp_as_persistence_timestamp' => 'useTimestampAsPersistenceTimestamp', 'value' => 'value', @@ -238,8 +250,11 @@ public function isNullableSetToNull(string $property): bool 'updated_by_user_id' => 'setUpdatedByUserId', 'persistence_timestamp' => 'setPersistenceTimestamp', 'source_metadata' => 'setSourceMetadata', + 'data_sensitivity' => 'setDataSensitivity', 'source_vid' => 'setSourceVid', + 'unit' => 'setUnit', 'request_id' => 'setRequestId', + 'is_encrypted' => 'setIsEncrypted', 'name' => 'setName', 'use_timestamp_as_persistence_timestamp' => 'setUseTimestampAsPersistenceTimestamp', 'value' => 'setValue', @@ -261,8 +276,11 @@ public function isNullableSetToNull(string $property): bool 'updated_by_user_id' => 'getUpdatedByUserId', 'persistence_timestamp' => 'getPersistenceTimestamp', 'source_metadata' => 'getSourceMetadata', + 'data_sensitivity' => 'getDataSensitivity', 'source_vid' => 'getSourceVid', + 'unit' => 'getUnit', 'request_id' => 'getRequestId', + 'is_encrypted' => 'getIsEncrypted', 'name' => 'getName', 'use_timestamp_as_persistence_timestamp' => 'getUseTimestampAsPersistenceTimestamp', 'value' => 'getValue', @@ -312,6 +330,7 @@ public function getModelName() return self::$openAPIModelName; } + public const SOURCE_UNKNOWN = 'UNKNOWN'; public const SOURCE_IMPORT = 'IMPORT'; public const SOURCE_API = 'API'; public const SOURCE_FORM = 'FORM'; @@ -391,6 +410,20 @@ public function getModelName() public const SOURCE_SLACK_INTEGRATION = 'SLACK_INTEGRATION'; public const SOURCE_CRM_UI_BULK_ACTION = 'CRM_UI_BULK_ACTION'; public const SOURCE_WORKFLOW_CONTACT_DELETE_ACTION = 'WORKFLOW_CONTACT_DELETE_ACTION'; + public const SOURCE_ACCEPTANCE_TEST = 'ACCEPTANCE_TEST'; + public const SOURCE_PLAYBOOKS = 'PLAYBOOKS'; + public const SOURCE_CHATSPOT = 'CHATSPOT'; + public const SOURCE_FLYWHEEL_PRODUCT_DATA_SYNC = 'FLYWHEEL_PRODUCT_DATA_SYNC'; + public const SOURCE_HELP_DESK = 'HELP_DESK'; + public const SOURCE_BILLING = 'BILLING'; + public const SOURCE_DATA_ENRICHMENT = 'DATA_ENRICHMENT'; + public const SOURCE_AUTOMATION_JOURNEY = 'AUTOMATION_JOURNEY'; + public const SOURCE_MICROAPPS = 'MICROAPPS'; + public const SOURCE_INTENT = 'INTENT'; + public const SOURCE_PROSPECTING_AGENT = 'PROSPECTING_AGENT'; + public const DATA_SENSITIVITY_NONE = 'none'; + public const DATA_SENSITIVITY_STANDARD = 'standard'; + public const DATA_SENSITIVITY_HIGH = 'high'; /** * Gets allowable values of the enum @@ -400,6 +433,7 @@ public function getModelName() public function getSourceAllowableValues() { return [ + self::SOURCE_UNKNOWN, self::SOURCE_IMPORT, self::SOURCE_API, self::SOURCE_FORM, @@ -479,6 +513,31 @@ public function getSourceAllowableValues() self::SOURCE_SLACK_INTEGRATION, self::SOURCE_CRM_UI_BULK_ACTION, self::SOURCE_WORKFLOW_CONTACT_DELETE_ACTION, + self::SOURCE_ACCEPTANCE_TEST, + self::SOURCE_PLAYBOOKS, + self::SOURCE_CHATSPOT, + self::SOURCE_FLYWHEEL_PRODUCT_DATA_SYNC, + self::SOURCE_HELP_DESK, + self::SOURCE_BILLING, + self::SOURCE_DATA_ENRICHMENT, + self::SOURCE_AUTOMATION_JOURNEY, + self::SOURCE_MICROAPPS, + self::SOURCE_INTENT, + self::SOURCE_PROSPECTING_AGENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataSensitivityAllowableValues() + { + return [ + self::DATA_SENSITIVITY_NONE, + self::DATA_SENSITIVITY_STANDARD, + self::DATA_SENSITIVITY_HIGH, ]; } @@ -504,8 +563,11 @@ public function __construct(array $data = null) $this->setIfExists('updated_by_user_id', $data ?? [], null); $this->setIfExists('persistence_timestamp', $data ?? [], null); $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('data_sensitivity', $data ?? [], null); $this->setIfExists('source_vid', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('is_encrypted', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('use_timestamp_as_persistence_timestamp', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); @@ -565,12 +627,30 @@ public function listInvalidProperties() if ($this->container['source_metadata'] === null) { $invalidProperties[] = "'source_metadata' can't be null"; } + if ($this->container['data_sensitivity'] === null) { + $invalidProperties[] = "'data_sensitivity' can't be null"; + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!is_null($this->container['data_sensitivity']) && !in_array($this->container['data_sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $this->container['data_sensitivity'], + implode("', '", $allowedValues) + ); + } + if ($this->container['source_vid'] === null) { $invalidProperties[] = "'source_vid' can't be null"; } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } if ($this->container['request_id'] === null) { $invalidProperties[] = "'request_id' can't be null"; } + if ($this->container['is_encrypted'] === null) { + $invalidProperties[] = "'is_encrypted' can't be null"; + } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } @@ -797,6 +877,43 @@ public function setSourceMetadata($source_metadata) return $this; } + /** + * Gets data_sensitivity + * + * @return string + */ + public function getDataSensitivity() + { + return $this->container['data_sensitivity']; + } + + /** + * Sets data_sensitivity + * + * @param string $data_sensitivity data_sensitivity + * + * @return self + */ + public function setDataSensitivity($data_sensitivity) + { + if (is_null($data_sensitivity)) { + throw new \InvalidArgumentException('non-nullable data_sensitivity cannot be null'); + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!in_array($data_sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $data_sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_sensitivity'] = $data_sensitivity; + + return $this; + } + /** * Gets source_vid * @@ -824,6 +941,33 @@ public function setSourceVid($source_vid) return $this; } + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + /** * Gets request_id * @@ -851,6 +995,33 @@ public function setRequestId($request_id) return $this; } + /** + * Gets is_encrypted + * + * @return bool + */ + public function getIsEncrypted() + { + return $this->container['is_encrypted']; + } + + /** + * Sets is_encrypted + * + * @param bool $is_encrypted is_encrypted + * + * @return self + */ + public function setIsEncrypted($is_encrypted) + { + if (is_null($is_encrypted)) { + throw new \InvalidArgumentException('non-nullable is_encrypted cannot be null'); + } + $this->container['is_encrypted'] = $is_encrypted; + + return $this; + } + /** * Gets name * diff --git a/codegen/Marketing/Events/Model/PublicList.php b/codegen/Marketing/Events/Model/PublicList.php new file mode 100644 index 00000000..863ab843 --- /dev/null +++ b/codegen/Marketing/Events/Model/PublicList.php @@ -0,0 +1,835 @@ + + */ +class PublicList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'processing_type' => 'string', + 'object_type_id' => 'string', + 'updated_by_id' => 'string', + 'filters_updated_at' => '\DateTime', + 'list_id' => 'string', + 'created_at' => '\DateTime', + 'processing_status' => 'string', + 'deleted_at' => '\DateTime', + 'list_version' => 'int', + 'size' => 'int', + 'name' => 'string', + 'created_by_id' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'processing_type' => null, + 'object_type_id' => null, + 'updated_by_id' => null, + 'filters_updated_at' => 'date-time', + 'list_id' => null, + 'created_at' => 'date-time', + 'processing_status' => null, + 'deleted_at' => 'date-time', + 'list_version' => 'int32', + 'size' => 'int64', + 'name' => null, + 'created_by_id' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'processing_type' => false, + 'object_type_id' => false, + 'updated_by_id' => false, + 'filters_updated_at' => false, + 'list_id' => false, + 'created_at' => false, + 'processing_status' => false, + 'deleted_at' => false, + 'list_version' => false, + 'size' => false, + 'name' => false, + 'created_by_id' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'processing_type' => 'processingType', + 'object_type_id' => 'objectTypeId', + 'updated_by_id' => 'updatedById', + 'filters_updated_at' => 'filtersUpdatedAt', + 'list_id' => 'listId', + 'created_at' => 'createdAt', + 'processing_status' => 'processingStatus', + 'deleted_at' => 'deletedAt', + 'list_version' => 'listVersion', + 'size' => 'size', + 'name' => 'name', + 'created_by_id' => 'createdById', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'processing_type' => 'setProcessingType', + 'object_type_id' => 'setObjectTypeId', + 'updated_by_id' => 'setUpdatedById', + 'filters_updated_at' => 'setFiltersUpdatedAt', + 'list_id' => 'setListId', + 'created_at' => 'setCreatedAt', + 'processing_status' => 'setProcessingStatus', + 'deleted_at' => 'setDeletedAt', + 'list_version' => 'setListVersion', + 'size' => 'setSize', + 'name' => 'setName', + 'created_by_id' => 'setCreatedById', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'processing_type' => 'getProcessingType', + 'object_type_id' => 'getObjectTypeId', + 'updated_by_id' => 'getUpdatedById', + 'filters_updated_at' => 'getFiltersUpdatedAt', + 'list_id' => 'getListId', + 'created_at' => 'getCreatedAt', + 'processing_status' => 'getProcessingStatus', + 'deleted_at' => 'getDeletedAt', + 'list_version' => 'getListVersion', + 'size' => 'getSize', + 'name' => 'getName', + 'created_by_id' => 'getCreatedById', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('processing_type', $data ?? [], null); + $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('updated_by_id', $data ?? [], null); + $this->setIfExists('filters_updated_at', $data ?? [], null); + $this->setIfExists('list_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('processing_status', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('list_version', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('created_by_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['processing_type'] === null) { + $invalidProperties[] = "'processing_type' can't be null"; + } + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['list_id'] === null) { + $invalidProperties[] = "'list_id' can't be null"; + } + if ($this->container['processing_status'] === null) { + $invalidProperties[] = "'processing_status' can't be null"; + } + if ($this->container['list_version'] === null) { + $invalidProperties[] = "'list_version' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets processing_type + * + * @return string + */ + public function getProcessingType() + { + return $this->container['processing_type']; + } + + /** + * Sets processing_type + * + * @param string $processing_type processing_type + * + * @return self + */ + public function setProcessingType($processing_type) + { + if (is_null($processing_type)) { + throw new \InvalidArgumentException('non-nullable processing_type cannot be null'); + } + $this->container['processing_type'] = $processing_type; + + 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 object_type_id + * + * @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 updated_by_id + * + * @return string|null + */ + public function getUpdatedById() + { + return $this->container['updated_by_id']; + } + + /** + * Sets updated_by_id + * + * @param string|null $updated_by_id updated_by_id + * + * @return self + */ + public function setUpdatedById($updated_by_id) + { + if (is_null($updated_by_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_id cannot be null'); + } + $this->container['updated_by_id'] = $updated_by_id; + + return $this; + } + + /** + * Gets filters_updated_at + * + * @return \DateTime|null + */ + public function getFiltersUpdatedAt() + { + return $this->container['filters_updated_at']; + } + + /** + * Sets filters_updated_at + * + * @param \DateTime|null $filters_updated_at filters_updated_at + * + * @return self + */ + public function setFiltersUpdatedAt($filters_updated_at) + { + if (is_null($filters_updated_at)) { + throw new \InvalidArgumentException('non-nullable filters_updated_at cannot be null'); + } + $this->container['filters_updated_at'] = $filters_updated_at; + + return $this; + } + + /** + * Gets list_id + * + * @return string + */ + public function getListId() + { + return $this->container['list_id']; + } + + /** + * Sets list_id + * + * @param string $list_id list_id + * + * @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 created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets processing_status + * + * @return string + */ + public function getProcessingStatus() + { + return $this->container['processing_status']; + } + + /** + * Sets processing_status + * + * @param string $processing_status processing_status + * + * @return self + */ + public function setProcessingStatus($processing_status) + { + if (is_null($processing_status)) { + throw new \InvalidArgumentException('non-nullable processing_status cannot be null'); + } + $this->container['processing_status'] = $processing_status; + + return $this; + } + + /** + * Gets deleted_at + * + * @return \DateTime|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param \DateTime|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets list_version + * + * @return int + */ + public function getListVersion() + { + return $this->container['list_version']; + } + + /** + * Sets list_version + * + * @param int $list_version list_version + * + * @return self + */ + public function setListVersion($list_version) + { + if (is_null($list_version)) { + throw new \InvalidArgumentException('non-nullable list_version cannot be null'); + } + $this->container['list_version'] = $list_version; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size size + * + * @return self + */ + public function setSize($size) + { + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets created_by_id + * + * @return string|null + */ + public function getCreatedById() + { + return $this->container['created_by_id']; + } + + /** + * Sets created_by_id + * + * @param string|null $created_by_id created_by_id + * + * @return self + */ + public function setCreatedById($created_by_id) + { + if (is_null($created_by_id)) { + throw new \InvalidArgumentException('non-nullable created_by_id cannot be null'); + } + $this->container['created_by_id'] = $created_by_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/StandardError.php b/codegen/Marketing/Events/Model/StandardError.php index 355cc27b..b29bda3e 100644 --- a/codegen/Marketing/Events/Model/StandardError.php +++ b/codegen/Marketing/Events/Model/StandardError.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/SubscriberEmailResponse.php b/codegen/Marketing/Events/Model/SubscriberEmailResponse.php index 3c1bdb54..2b0fedcc 100644 --- a/codegen/Marketing/Events/Model/SubscriberEmailResponse.php +++ b/codegen/Marketing/Events/Model/SubscriberEmailResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/Model/SubscriberVidResponse.php b/codegen/Marketing/Events/Model/SubscriberVidResponse.php index d4123b21..5a8316bb 100644 --- a/codegen/Marketing/Events/Model/SubscriberVidResponse.php +++ b/codegen/Marketing/Events/Model/SubscriberVidResponse.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech diff --git a/codegen/Marketing/Events/ObjectSerializer.php b/codegen/Marketing/Events/ObjectSerializer.php index ff3aaf89..7d342f4a 100644 --- a/codegen/Marketing/Events/ObjectSerializer.php +++ b/codegen/Marketing/Events/ObjectSerializer.php @@ -13,7 +13,7 @@ /** * Marketing Events * - * These APIs allow you to interact with HubSpot's Marketing Events Extension. It allows you to: * Create, Read or update Marketing Event information in HubSpot * Specify whether a HubSpot contact has registered, attended or cancelled a registration to a Marketing Event. * Specify a URL that can be called to get the details of a Marketing Event. + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech From 004ca69cc3a7bb7569578844a85c2322e0ac06bc Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 21 Oct 2024 15:41:25 +0300 Subject: [PATCH 2/2] Update Marketing Events discoveries. --- lib/Discovery/Marketing/Events/Discovery.php | 18 ++++++++---------- .../Marketing/Events/DiscoverySpec.php | 10 ++++------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/Discovery/Marketing/Events/Discovery.php b/lib/Discovery/Marketing/Events/Discovery.php index f57e87ad..b26d4397 100644 --- a/lib/Discovery/Marketing/Events/Discovery.php +++ b/lib/Discovery/Marketing/Events/Discovery.php @@ -4,20 +4,18 @@ use HubSpot\Client\Marketing\Events\Api\AttendanceSubscriberStateChangesApi; use HubSpot\Client\Marketing\Events\Api\BasicApi; -use HubSpot\Client\Marketing\Events\Api\BatchApi; -use HubSpot\Client\Marketing\Events\Api\MarketingEventsExternalApi; -use HubSpot\Client\Marketing\Events\Api\SearchApi; +use HubSpot\Client\Marketing\Events\Api\ListAssociationsApi; +use HubSpot\Client\Marketing\Events\Api\ParticipantStateApi; use HubSpot\Client\Marketing\Events\Api\SettingsApi; use HubSpot\Client\Marketing\Events\Api\SubscriberStateChangesApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method AttendanceSubscriberStateChangesApi attendanceSubscriberStateChangesApi() - * @method BasicApi basicApi() - * @method BatchApi batchApi() - * @method MarketingEventsExternalApi marketingEventsExternalApi() - * @method SearchApi searchApi() - * @method SettingsApi settingsApi() - * @method SubscriberStateChangesApi subscriberStateChangesApi() + * @method AttendanceSubscriberStateChangesApi attendanceSubscriberStateChangesApi() + * @method BasicApi basicApi() + * @method ListAssociationsApi listAssociationsApi() + * @method ParticipantStateApi participantStateApi() + * @method SettingsApi settingsApi() + * @method SubscriberStateChangesApi subscriberStateChangesApi() */ class Discovery extends DiscoveryBase {} diff --git a/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php index dbaa6129..2bc371f2 100644 --- a/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php @@ -5,9 +5,8 @@ use GuzzleHttp\Client; use HubSpot\Client\Marketing\Events\Api\AttendanceSubscriberStateChangesApi; use HubSpot\Client\Marketing\Events\Api\BasicApi; -use HubSpot\Client\Marketing\Events\Api\BatchApi; -use HubSpot\Client\Marketing\Events\Api\MarketingEventsExternalApi; -use HubSpot\Client\Marketing\Events\Api\SearchApi; +use HubSpot\Client\Marketing\Events\Api\ListAssociationsApi; +use HubSpot\Client\Marketing\Events\Api\ParticipantStateApi; use HubSpot\Client\Marketing\Events\Api\SettingsApi; use HubSpot\Client\Marketing\Events\Api\SubscriberStateChangesApi; use HubSpot\Config; @@ -30,9 +29,8 @@ public function it_creates_clients() { $this->attendanceSubscriberStateChangesApi()->shouldHaveType(AttendanceSubscriberStateChangesApi::class); $this->basicApi()->shouldHaveType(BasicApi::class); - $this->batchApi()->shouldHaveType(BatchApi::class); - $this->marketingEventsExternalApi()->shouldHaveType(MarketingEventsExternalApi::class); - $this->searchApi()->shouldHaveType(SearchApi::class); + $this->listAssociationsApi()->shouldHaveType(ListAssociationsApi::class); + $this->participantStateApi()->shouldHaveType(ParticipantStateApi::class); $this->settingsApi()->shouldHaveType(SettingsApi::class); $this->subscriberStateChangesApi()->shouldHaveType(SubscriberStateChangesApi::class); }