From da992a1aa1a0e30f2e1dc29721996facc7bcfac8 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Wed, 16 Apr 2025 15:14:51 +0300 Subject: [PATCH] Codegen: Marketing Events --- .../Events/Api/AddEventAttendeesApi.php | 1722 +++++++++++++++++ codegen/Marketing/Events/Api/BasicApi.php | 1234 ++++-------- codegen/Marketing/Events/Api/BatchApi.php | 1427 ++++++++++++++ ...teChangesApi.php => ChangePropertyApi.php} | 269 ++- .../Marketing/Events/Api/IdentifiersApi.php | 839 ++++++++ .../Events/Api/ListAssociationsApi.php | 10 +- ...pi.php => RetrieveParticipantStateApi.php} | 6 +- .../Events/Api/SubscriberStateChangesApi.php | 40 +- codegen/Marketing/Events/Model/AppInfo.php | 449 +++++ ...ketingEventPublicObjectIdDeleteRequest.php | 412 ++++ ...arketingEventPublicUpdateRequestFullV2.php | 412 ++++ ...eMarketingEventPublicDefaultResponseV2.php | 629 ++++++ ...EventPublicDefaultResponseV2WithErrors.php | 697 +++++++ ...EventPublicReadResponseV2ForwardPaging.php | 446 +++++ ...seSearchPublicResponseWrapperNoPaging.php} | 14 +- ...ketingEventIdentifiersResponseNoPaging.php | 449 +++++ .../Events/Model/CrmPropertyWrapper.php | 449 +++++ .../Model/MarketingEventDefaultResponse.php | 46 +- .../Model/MarketingEventEmailSubscriber.php | 2 +- .../MarketingEventIdentifiersResponse.php | 554 ++++++ .../MarketingEventPublicDefaultResponse.php | 34 + .../MarketingEventPublicDefaultResponseV2.php | 866 +++++++++ ...ketingEventPublicObjectIdDeleteRequest.php | 412 ++++ .../MarketingEventPublicReadResponse.php | 34 + .../MarketingEventPublicReadResponseV2.php | 1070 ++++++++++ ...arketingEventPublicUpdateRequestFullV2.php | 721 +++++++ .../MarketingEventPublicUpdateRequestV2.php | 684 +++++++ .../Events/Model/MarketingEventSubscriber.php | 2 +- .../Marketing/Events/Model/PropertyValue.php | 2 + .../Model/SearchPublicResponseWrapper.php | 523 +++++ 30 files changed, 13411 insertions(+), 1043 deletions(-) create mode 100644 codegen/Marketing/Events/Api/AddEventAttendeesApi.php create mode 100644 codegen/Marketing/Events/Api/BatchApi.php rename codegen/Marketing/Events/Api/{AttendanceSubscriberStateChangesApi.php => ChangePropertyApi.php} (65%) create mode 100644 codegen/Marketing/Events/Api/IdentifiersApi.php rename codegen/Marketing/Events/Api/{ParticipantStateApi.php => RetrieveParticipantStateApi.php} (99%) create mode 100644 codegen/Marketing/Events/Model/AppInfo.php create mode 100644 codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php create mode 100644 codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php create mode 100644 codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php create mode 100644 codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php create mode 100644 codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php rename codegen/Marketing/Events/Model/{CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php => CollectionResponseSearchPublicResponseWrapperNoPaging.php} (93%) create mode 100644 codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php create mode 100644 codegen/Marketing/Events/Model/CrmPropertyWrapper.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php create mode 100644 codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php create mode 100644 codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php diff --git a/codegen/Marketing/Events/Api/AddEventAttendeesApi.php b/codegen/Marketing/Events/Api/AddEventAttendeesApi.php new file mode 100644 index 000000000..e65b94a27 --- /dev/null +++ b/codegen/Marketing/Events/Api/AddEventAttendeesApi.php @@ -0,0 +1,1722 @@ + [ + 'application/json', + ], + 'recordByContactId' => [ + 'application/json', + ], + 'recordByContactIds' => [ + 'application/json', + ], + 'recordByEmail' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $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 recordByContactEmails + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactEmails($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + list($response) = $this->recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + return $response; + } + + /** + * Operation recordByContactEmailsWithHttpInfo + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactEmailsAsync + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactEmailsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + return $this->recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactEmailsAsyncWithHttpInfo + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'recordByContactEmails' + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling recordByContactEmails' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactEmails' + ); + } + + // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set + if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByContactEmails' + ); + } + + + + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_email_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_email_subscriber; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByContactId + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactId($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + list($response) = $this->recordByContactIdWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType); + return $response; + } + + /** + * Operation recordByContactIdWithHttpInfo + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactIdWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + $request = $this->recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactIdAsync + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdAsync($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + return $this->recordByContactIdAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactIdAsyncWithHttpInfo + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $request = $this->recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'recordByContactId' + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling recordByContactId' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactId' + ); + } + + // verify the required parameter 'batch_input_marketing_event_subscriber' is set + if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_subscriber; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByContactIds + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactIds($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + list($response) = $this->recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + return $response; + } + + /** + * Operation recordByContactIdsWithHttpInfo + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactIdsAsync + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + return $this->recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactIdsAsyncWithHttpInfo + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'recordByContactIds' + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling recordByContactIds' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactIds' + ); + } + + // verify the required parameter 'batch_input_marketing_event_subscriber' is set + if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactIds' + ); + } + + + + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_subscriber; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByEmail + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByEmail($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + list($response) = $this->recordByEmailWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType); + return $response; + } + + /** + * Operation recordByEmailWithHttpInfo + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByEmailWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + $request = $this->recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByEmailAsync + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByEmailAsync($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + return $this->recordByEmailAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByEmailAsyncWithHttpInfo + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByEmailAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $request = $this->recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'recordByEmail' + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling recordByEmail' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByEmail' + ); + } + + // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set + if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByEmail' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/email-create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_email_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_email_subscriber; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/BasicApi.php b/codegen/Marketing/Events/Api/BasicApi.php index 3800315a9..1d2dc44cb 100644 --- a/codegen/Marketing/Events/Api/BasicApi.php +++ b/codegen/Marketing/Events/Api/BasicApi.php @@ -74,22 +74,16 @@ class BasicApi 'archive' => [ 'application/json', ], - 'batchArchive' => [ + 'archiveByObjectId' => [ 'application/json', ], - 'batchUpsert' => [ - 'application/json', - ], - 'cancel' => [ - 'application/json', - ], - 'complete' => [ + 'create' => [ 'application/json', ], - 'create' => [ + 'getAll' => [ 'application/json', ], - 'doSearch' => [ + 'getByObjectId' => [ 'application/json', ], 'getDetails' => [ @@ -98,6 +92,9 @@ class BasicApi 'update' => [ 'application/json', ], + 'updateByObjectId' => [ + 'application/json', + ], 'upsert' => [ 'application/json', ], @@ -152,10 +149,10 @@ public function getConfig() /** * Operation archive * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -170,10 +167,10 @@ public function archive($external_event_id, $external_account_id, string $conten /** * Operation archiveWithHttpInfo * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -239,10 +236,10 @@ public function archiveWithHttpInfo($external_event_id, $external_account_id, st /** * Operation archiveAsync * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -261,10 +258,10 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -301,8 +298,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -412,38 +409,37 @@ public function archiveRequest($external_event_id, $external_account_id, string } /** - * Operation batchArchive + * Operation archiveByObjectId * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\Error + * @return void */ - public function batchArchive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectId($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - list($response) = $this->batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); - return $response; + $this->archiveByObjectIdWithHttpInfo($object_id, $contentType); } /** - * Operation batchArchiveWithHttpInfo + * Operation archiveByObjectIdWithHttpInfo * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdWithHttpInfo($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + $request = $this->archiveByObjectIdRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -480,63 +476,7 @@ public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_u ); } - switch($statusCode) { - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { @@ -554,19 +494,19 @@ public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_u } /** - * Operation batchArchiveAsync + * Operation archiveByObjectIdAsync * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchArchiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdAsync($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - return $this->batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) + return $this->archiveByObjectIdAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -575,39 +515,26 @@ function ($response) { } /** - * Operation batchArchiveAsyncWithHttpInfo + * Operation archiveByObjectIdAsyncWithHttpInfo * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + $returnType = ''; + $request = $this->archiveByObjectIdRequest($object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -627,26 +554,26 @@ function ($exception) { } /** - * Create request for operation 'batchArchive' + * Create request for operation 'archiveByObjectId' * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdRequest($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set - if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling batchArchive' + 'Missing the required parameter $object_id when calling archiveByObjectId' ); } - $resourcePath = '/marketing/v3/marketing-events/events/delete'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -655,6 +582,14 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -664,14 +599,7 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique ); // for model (json/xml) - if (isset($batch_input_marketing_event_external_unique_identifier)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); - } else { - $httpBody = $batch_input_marketing_event_external_unique_identifier; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -714,7 +642,7 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -722,38 +650,38 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique } /** - * Operation batchUpsert + * Operation create * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function batchUpsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function create($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); + list($response) = $this->createWithHttpInfo($marketing_event_create_request_params, $contentType); return $response; } /** - * Operation batchUpsertWithHttpInfo + * Operation createWithHttpInfo * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + $request = $this->createRequest($marketing_event_create_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -792,11 +720,11 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -814,7 +742,7 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -847,7 +775,7 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -880,7 +808,7 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -899,19 +827,19 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ } /** - * Operation batchUpsertAsync + * Operation createAsync * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchUpsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createAsync($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - return $this->batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) + return $this->createAsyncWithHttpInfo($marketing_event_create_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -920,20 +848,20 @@ function ($response) { } /** - * Operation batchUpsertAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createAsyncWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; - $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->createRequest($marketing_event_create_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -972,26 +900,26 @@ function ($exception) { } /** - * Create request for operation 'batchUpsert' + * Create request for operation 'create' * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function batchUpsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createRequest($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_marketing_event_create_request_params' is set - if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { + // verify the required parameter 'marketing_event_create_request_params' is set + if ($marketing_event_create_request_params === null || (is_array($marketing_event_create_request_params) && count($marketing_event_create_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling batchUpsert' + 'Missing the required parameter $marketing_event_create_request_params when calling create' ); } - $resourcePath = '/marketing/v3/marketing-events/events/upsert'; + $resourcePath = '/marketing/v3/marketing-events/events'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1009,12 +937,12 @@ public function batchUpsertRequest($batch_input_marketing_event_create_request_p ); // for model (json/xml) - if (isset($batch_input_marketing_event_create_request_params)) { + if (isset($marketing_event_create_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); } else { - $httpBody = $batch_input_marketing_event_create_request_params; + $httpBody = $marketing_event_create_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1067,40 +995,40 @@ public function batchUpsertRequest($batch_input_marketing_event_create_request_p } /** - * Operation cancel + * Operation getAll * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string $after The cursor indicating the position of the last retrieved item. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error */ - public function cancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAll($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->cancelWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->getAllWithHttpInfo($after, $limit, $contentType); return $response; } /** - * Operation cancelWithHttpInfo + * Operation getAllWithHttpInfo * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string $after The cursor indicating the position of the last retrieved item. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function cancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllWithHttpInfo($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + $request = $this->getAllRequest($after, $limit, $contentType); try { $options = $this->createHttpClientOption(); @@ -1139,11 +1067,11 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1161,7 +1089,7 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1194,7 +1122,7 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1227,7 +1155,7 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1246,20 +1174,20 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str } /** - * Operation cancelAsync + * Operation getAllAsync * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string $after The cursor indicating the position of the last retrieved item. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllAsync($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - return $this->cancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->getAllAsyncWithHttpInfo($after, $limit, $contentType) ->then( function ($response) { return $response[0]; @@ -1268,21 +1196,21 @@ function ($response) { } /** - * Operation cancelAsyncWithHttpInfo + * Operation getAllAsyncWithHttpInfo * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string $after The cursor indicating the position of the last retrieved item. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllAsyncWithHttpInfo($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; + $request = $this->getAllRequest($after, $limit, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1321,34 +1249,22 @@ function ($exception) { } /** - * Create request for operation 'cancel' + * Create request for operation 'getAll' * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string $after The cursor indicating the position of the last retrieved item. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function cancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllRequest($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling cancel' - ); - } - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling cancel' - ); - } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; + $resourcePath = '/marketing/v3/marketing-events/'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1357,23 +1273,24 @@ public function cancelRequest($external_event_id, $external_account_id, string $ // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name + $after, + 'after', // param base name 'string', // openApiType 'form', // style true, // explode - true // required + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required ) ?? []); - // path params - if ($external_event_id !== null) { - $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -1426,7 +1343,7 @@ public function cancelRequest($external_event_id, $external_account_id, string $ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1434,42 +1351,38 @@ public function cancelRequest($external_event_id, $external_account_id, string $ } /** - * Operation complete + * Operation getByObjectId * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2|\HubSpot\Client\Marketing\Events\Model\Error */ - public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectId($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + list($response) = $this->getByObjectIdWithHttpInfo($object_id, $contentType); return $response; } /** - * Operation completeWithHttpInfo + * Operation getByObjectIdWithHttpInfo * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdWithHttpInfo($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + $request = $this->getByObjectIdRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1508,11 +1421,11 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1530,7 +1443,7 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1563,7 +1476,7 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1596,7 +1509,7 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1615,21 +1528,19 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ } /** - * Operation completeAsync + * Operation getByObjectIdAsync * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdAsync($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) + return $this->getByObjectIdAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1638,22 +1549,20 @@ function ($response) { } /** - * Operation completeAsyncWithHttpInfo + * Operation getByObjectIdAsyncWithHttpInfo * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2'; + $request = $this->getByObjectIdRequest($object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1692,64 +1601,39 @@ function ($exception) { } /** - * Create request for operation 'complete' + * Create request for operation 'getByObjectId' * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdRequest($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - 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)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_complete_request_params when calling complete' + 'Missing the required parameter $object_id when calling getByObjectId' ); } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($external_event_id !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } @@ -1762,14 +1646,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke ); // for model (json/xml) - if (isset($marketing_event_complete_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); - } else { - $httpBody = $marketing_event_complete_request_params; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1812,7 +1689,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1820,38 +1697,40 @@ public function completeRequest($external_event_id, $external_account_id, $marke } /** - * Operation create + * Operation getDetails * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function create($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetails($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - list($response) = $this->createWithHttpInfo($marketing_event_create_request_params, $contentType); + list($response) = $this->getDetailsWithHttpInfo($external_event_id, $external_account_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getDetailsWithHttpInfo * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetailsWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - $request = $this->createRequest($marketing_event_create_request_params, $contentType); + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1890,11 +1769,11 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1912,7 +1791,7 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1945,7 +1824,7 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1978,7 +1857,7 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1997,19 +1876,20 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin } /** - * Operation createAsync + * Operation getDetailsAsync * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetailsAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - return $this->createAsyncWithHttpInfo($marketing_event_create_request_params, $contentType) + return $this->getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2018,20 +1898,21 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getDetailsAsyncWithHttpInfo * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->createRequest($marketing_event_create_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2070,371 +1951,34 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'getDetails' * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetailsRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][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)) { + // 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 $marketing_event_create_request_params when calling create' + 'Missing the required parameter $external_event_id when calling getDetails' ); } - - $resourcePath = '/marketing/v3/marketing-events/events'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($marketing_event_create_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); - } else { - $httpBody = $marketing_event_create_request_params; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation doSearch - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error - */ - public function doSearch($q, string $contentType = self::contentTypes['doSearch'][0]) - { - list($response) = $this->doSearchWithHttpInfo($q, $contentType); - return $response; - } - - /** - * Operation doSearchWithHttpInfo - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doSearchWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) - { - $request = $this->doSearchRequest($q, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%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)) { + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $q when calling doSearch' + 'Missing the required parameter $external_account_id when calling getDetails' ); } - $resourcePath = '/marketing/v3/marketing-events/events/search'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2443,8 +1987,8 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $q, - 'q', // param base name + $external_account_id, + 'externalAccountId', // param base name 'string', // openApiType 'form', // style true, // explode @@ -2452,6 +1996,14 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do ) ?? []); + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -2512,40 +2064,42 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do } /** - * Operation getDetails + * Operation update * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getDetails($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->getDetailsWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $response; } /** - * Operation getDetailsWithHttpInfo + * Operation updateWithHttpInfo * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getDetailsWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -2584,11 +2138,11 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2606,7 +2160,7 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2639,7 +2193,7 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2672,7 +2226,7 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2691,20 +2245,21 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, } /** - * Operation getDetailsAsync + * Operation updateAsync * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDetailsAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - return $this->getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -2713,21 +2268,22 @@ function ($response) { } /** - * Operation getDetailsAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; - $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2766,29 +2322,37 @@ function ($exception) { } /** - * Create request for operation 'getDetails' + * Create request for operation 'update' * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getDetailsRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling getDetails' + 'Missing the required parameter $external_event_id when calling update' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling getDetails' + 'Missing the required parameter $external_account_id when calling update' + ); + } + + // verify the required parameter 'marketing_event_update_request_params' is set + if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_update_request_params when calling update' ); } @@ -2828,7 +2392,14 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($marketing_event_update_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); + } else { + $httpBody = $marketing_event_update_request_params; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2871,7 +2442,7 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'PATCH', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2879,42 +2450,40 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri } /** - * Operation update + * Operation updateByObjectId * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\Error */ - public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectId($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + list($response) = $this->updateByObjectIdWithHttpInfo($object_id, $marketing_event_public_update_request_v2, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation updateByObjectIdWithHttpInfo * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdWithHttpInfo($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $request = $this->updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, $contentType); try { $options = $this->createHttpClientOption(); @@ -2953,11 +2522,11 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2975,7 +2544,7 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3008,7 +2577,7 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -3041,7 +2610,7 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3060,21 +2629,20 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma } /** - * Operation updateAsync + * Operation updateByObjectIdAsync * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdAsync($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) + return $this->updateByObjectIdAsyncWithHttpInfo($object_id, $marketing_event_public_update_request_v2, $contentType) ->then( function ($response) { return $response[0]; @@ -3083,22 +2651,21 @@ function ($response) { } /** - * Operation updateAsyncWithHttpInfo + * Operation updateByObjectIdAsyncWithHttpInfo * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdAsyncWithHttpInfo($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2'; + $request = $this->updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3137,64 +2704,47 @@ function ($exception) { } /** - * Create request for operation 'update' + * Create request for operation 'updateByObjectId' * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling update' + 'Missing the required parameter $object_id when calling updateByObjectId' ); } - // 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 'marketing_event_public_update_request_v2' is set + if ($marketing_event_public_update_request_v2 === null || (is_array($marketing_event_public_update_request_v2) && count($marketing_event_public_update_request_v2) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling update' - ); - } - - // verify the required parameter 'marketing_event_update_request_params' is set - if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_update_request_params when calling update' + 'Missing the required parameter $marketing_event_public_update_request_v2 when calling updateByObjectId' ); } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($external_event_id !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } @@ -3207,12 +2757,12 @@ public function updateRequest($external_event_id, $external_account_id, $marketi ); // for model (json/xml) - if (isset($marketing_event_update_request_params)) { + if (isset($marketing_event_public_update_request_v2)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_public_update_request_v2)); } else { - $httpBody = $marketing_event_update_request_params; + $httpBody = $marketing_event_public_update_request_v2; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -3269,7 +2819,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3288,7 +2838,7 @@ public function upsert($external_event_id, $marketing_event_create_request_param * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3448,7 +2998,7 @@ public function upsertWithHttpInfo($external_event_id, $marketing_event_create_r * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3470,7 +3020,7 @@ function ($response) { * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3521,7 +3071,7 @@ function ($exception) { /** * Create request for operation 'upsert' * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * diff --git a/codegen/Marketing/Events/Api/BatchApi.php b/codegen/Marketing/Events/Api/BatchApi.php new file mode 100644 index 000000000..e82e3756f --- /dev/null +++ b/codegen/Marketing/Events/Api/BatchApi.php @@ -0,0 +1,1427 @@ + [ + 'application/json', + ], + 'archiveByObjectId' => [ + 'application/json', + ], + 'updateByObjectId' => [ + 'application/json', + ], + 'upsert' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $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 by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\Error + */ + public function archive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + list($response) = $this->archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); + return $response; + } + + /** + * Operation archiveWithHttpInfo + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 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 by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; + $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archive' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set + if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling archive' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_external_unique_identifier)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); + } else { + $httpBody = $batch_input_marketing_event_external_unique_identifier; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation archiveByObjectId + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archiveByObjectId($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $this->archiveByObjectIdWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, $contentType); + } + + /** + * Operation archiveByObjectIdWithHttpInfo + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveByObjectIdWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $request = $this->archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $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 archiveByObjectIdAsync + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveByObjectIdAsync($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + return $this->archiveByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveByObjectIdAsyncWithHttpInfo + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $returnType = ''; + $request = $this->archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archiveByObjectId' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_public_object_id_delete_request' is set + if ($batch_input_marketing_event_public_object_id_delete_request === null || (is_array($batch_input_marketing_event_public_object_id_delete_request) && count($batch_input_marketing_event_public_object_id_delete_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_public_object_id_delete_request when calling archiveByObjectId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_public_object_id_delete_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_object_id_delete_request)); + } else { + $httpBody = $batch_input_marketing_event_public_object_id_delete_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateByObjectId + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function updateByObjectId($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + list($response) = $this->updateByObjectIdWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, $contentType); + return $response; + } + + /** + * Operation updateByObjectIdWithHttpInfo + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateByObjectIdWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + $request = $this->updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw 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\BatchResponseMarketingEventPublicDefaultResponseV2' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateByObjectIdAsync + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateByObjectIdAsync($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + return $this->updateByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateByObjectIdAsyncWithHttpInfo + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2'; + $request = $this->updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateByObjectId' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_public_update_request_full_v2' is set + if ($batch_input_marketing_event_public_update_request_full_v2 === null || (is_array($batch_input_marketing_event_public_update_request_full_v2) && count($batch_input_marketing_event_public_update_request_full_v2) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_public_update_request_full_v2 when calling updateByObjectId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_public_update_request_full_v2)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_update_request_full_v2)); + } else { + $httpBody = $batch_input_marketing_event_public_update_request_full_v2; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsert + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function upsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_marketing_event_create_request_params, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw 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 upsertAsync + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + $request = $this->upsertRequest($batch_input_marketing_event_create_request_params, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upsert' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_create_request_params' is set + if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling upsert' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_create_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); + } else { + $httpBody = $batch_input_marketing_event_create_request_params; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/ChangePropertyApi.php similarity index 65% rename from codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php rename to codegen/Marketing/Events/Api/ChangePropertyApi.php index 6a163ea46..00a82329b 100644 --- a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/ChangePropertyApi.php @@ -1,6 +1,6 @@ [ + 'cancel' => [ 'application/json', ], - 'recordByContactIds' => [ + 'complete' => [ 'application/json', ], ]; @@ -126,44 +126,40 @@ public function getConfig() } /** - * Operation recordByContactEmails + * Operation cancel * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function recordByContactEmails($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - list($response) = $this->recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + list($response) = $this->cancelWithHttpInfo($external_event_id, $external_account_id, $contentType); return $response; } /** - * Operation recordByContactEmailsWithHttpInfo + * Operation cancelWithHttpInfo * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -202,11 +198,11 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -224,7 +220,7 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -257,7 +253,7 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -290,7 +286,7 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -309,22 +305,20 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe } /** - * Operation recordByContactEmailsAsync + * Operation cancelAsync * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactEmailsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - return $this->recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) + return $this->cancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -333,23 +327,21 @@ function ($response) { } /** - * Operation recordByContactEmailsAsyncWithHttpInfo + * Operation cancelAsyncWithHttpInfo * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; - $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -388,44 +380,34 @@ function ($exception) { } /** - * Create request for operation 'recordByContactEmails' + * Create request for operation 'cancel' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling recordByContactEmails' + 'Missing the required parameter $external_event_id when calling cancel' ); } - // verify the required parameter 'subscriber_state' is set - if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling recordByContactEmails' + 'Missing the required parameter $external_account_id when calling cancel' ); } - // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set - if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByContactEmails' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; $formParams = []; $queryParams = []; $headerParams = []; @@ -439,7 +421,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta 'string', // openApiType 'form', // style true, // explode - false // required + true // required ) ?? []); @@ -451,14 +433,6 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta $resourcePath ); } - // path params - if ($subscriber_state !== null) { - $resourcePath = str_replace( - '{' . 'subscriberState' . '}', - ObjectSerializer::toPathValue($subscriber_state), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -468,14 +442,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta ); // for model (json/xml) - if (isset($batch_input_marketing_event_email_subscriber)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); - } else { - $httpBody = $batch_input_marketing_event_email_subscriber; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -526,44 +493,42 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta } /** - * Operation recordByContactIds + * Operation complete * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function recordByContactIds($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - list($response) = $this->recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); return $response; } /** - * Operation recordByContactIdsWithHttpInfo + * Operation completeWithHttpInfo * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -602,11 +567,11 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -624,7 +589,7 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -657,7 +622,7 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -690,7 +655,7 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -709,22 +674,21 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s } /** - * Operation recordByContactIdsAsync + * Operation completeAsync * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactIdsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - return $this->recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) + return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -733,23 +697,22 @@ function ($response) { } /** - * Operation recordByContactIdsAsyncWithHttpInfo + * Operation completeAsyncWithHttpInfo * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; - $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -788,44 +751,42 @@ function ($exception) { } /** - * Create request for operation 'recordByContactIds' + * Create request for operation 'complete' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling recordByContactIds' + 'Missing the required parameter $external_event_id when calling complete' ); } - // verify the required parameter 'subscriber_state' is set - if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling recordByContactIds' + 'Missing the required parameter $external_account_id when calling complete' ); } - // verify the required parameter 'batch_input_marketing_event_subscriber' is set - if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + // verify the required parameter 'marketing_event_complete_request_params' is set + if ($marketing_event_complete_request_params === null || (is_array($marketing_event_complete_request_params) && count($marketing_event_complete_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactIds' + 'Missing the required parameter $marketing_event_complete_request_params when calling complete' ); } - - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; $formParams = []; $queryParams = []; $headerParams = []; @@ -839,7 +800,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, 'string', // openApiType 'form', // style true, // explode - false // required + true // required ) ?? []); @@ -851,14 +812,6 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, $resourcePath ); } - // path params - if ($subscriber_state !== null) { - $resourcePath = str_replace( - '{' . 'subscriberState' . '}', - ObjectSerializer::toPathValue($subscriber_state), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -868,12 +821,12 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, ); // for model (json/xml) - if (isset($batch_input_marketing_event_subscriber)) { + if (isset($marketing_event_complete_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); } else { - $httpBody = $batch_input_marketing_event_subscriber; + $httpBody = $marketing_event_complete_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Marketing/Events/Api/IdentifiersApi.php b/codegen/Marketing/Events/Api/IdentifiersApi.php new file mode 100644 index 000000000..bd2570362 --- /dev/null +++ b/codegen/Marketing/Events/Api/IdentifiersApi.php @@ -0,0 +1,839 @@ + [ + 'application/json', + ], + 'searchPortalEvents' => [ + '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 + * + * Find App-Specific Marketing Events by External Event Id + * + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \HubSpot\Client\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\CollectionResponseSearchPublicResponseWrapperNoPaging|\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 + * + * Find App-Specific Marketing Events by External Event Id + * + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \HubSpot\Client\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\CollectionResponseSearchPublicResponseWrapperNoPaging|\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\CollectionResponseSearchPublicResponseWrapperNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging' !== 'string') { + try { + $content = 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\CollectionResponseSearchPublicResponseWrapperNoPaging', []), + $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\CollectionResponseSearchPublicResponseWrapperNoPaging'; + 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\CollectionResponseSearchPublicResponseWrapperNoPaging', + $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 + * + * Find App-Specific Marketing Events by External Event Id + * + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsync($q, string $contentType = self::contentTypes['doSearch'][0]) + { + return $this->doSearchAsyncWithHttpInfo($q, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation doSearchAsyncWithHttpInfo + * + * Find App-Specific Marketing Events by External Event Id + * + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsyncWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging'; + $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 (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function 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 + ); + } + + /** + * Operation searchPortalEvents + * + * Find Marketing Events by External Event Id + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation + * + * @throws \HubSpot\Client\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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function searchPortalEvents($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) + { + list($response) = $this->searchPortalEventsWithHttpInfo($external_event_id, $contentType); + return $response; + } + + /** + * Operation searchPortalEventsWithHttpInfo + * + * Find Marketing Events by External Event Id + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation + * + * @throws \HubSpot\Client\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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function searchPortalEventsWithHttpInfo($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) + { + $request = $this->searchPortalEventsRequest($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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging' !== 'string') { + try { + $content = 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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging', []), + $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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; + 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\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging', + $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 searchPortalEventsAsync + * + * Find Marketing Events by External Event Id + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function searchPortalEventsAsync($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) + { + return $this->searchPortalEventsAsyncWithHttpInfo($external_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation searchPortalEventsAsyncWithHttpInfo + * + * Find Marketing Events by External Event Id + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function searchPortalEventsAsyncWithHttpInfo($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; + $request = $this->searchPortalEventsRequest($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 'searchPortalEvents' + * + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function searchPortalEventsRequest($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling searchPortalEvents' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/{externalEventId}/identifiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // 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 + ); + } + + /** + * 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 index 83c36717c..82ccc4c43 100644 --- a/codegen/Marketing/Events/Api/ListAssociationsApi.php +++ b/codegen/Marketing/Events/Api/ListAssociationsApi.php @@ -1226,7 +1226,7 @@ public function disassociateByMarketingEventIdRequest($marketing_event_id, $list * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1245,7 +1245,7 @@ public function getAllByExternalAccountAndEventIds($external_account_id, $extern * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1405,7 +1405,7 @@ public function getAllByExternalAccountAndEventIdsWithHttpInfo($external_account * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1427,7 +1427,7 @@ function ($response) { * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1478,7 +1478,7 @@ function ($exception) { /** * Create request for operation 'getAllByExternalAccountAndEventIds' * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * diff --git a/codegen/Marketing/Events/Api/ParticipantStateApi.php b/codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php similarity index 99% rename from codegen/Marketing/Events/Api/ParticipantStateApi.php rename to codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php index f2d9a85c3..960764c3c 100644 --- a/codegen/Marketing/Events/Api/ParticipantStateApi.php +++ b/codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php @@ -1,6 +1,6 @@ + */ +class AppInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AppInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php new file mode 100644 index 000000000..486b95ace --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php @@ -0,0 +1,412 @@ + + */ +class BatchInputMarketingEventPublicObjectIdDeleteRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputMarketingEventPublicObjectIdDeleteRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php new file mode 100644 index 000000000..3e86d77ca --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php @@ -0,0 +1,412 @@ + + */ +class BatchInputMarketingEventPublicUpdateRequestFullV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputMarketingEventPublicUpdateRequestFullV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php new file mode 100644 index 000000000..8c4d744f3 --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseMarketingEventPublicDefaultResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseMarketingEventPublicDefaultResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php new file mode 100644 index 000000000..b7069e858 --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseMarketingEventPublicDefaultResponseV2WithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseMarketingEventPublicDefaultResponseV2WithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[]', + 'errors' => '\HubSpot\Client\Marketing\Events\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Marketing\Events\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Marketing\Events\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php new file mode 100644 index 000000000..f11843a2e --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php @@ -0,0 +1,446 @@ + + */ +class CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paging' => '\HubSpot\Client\Marketing\Events\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paging + * + * @return \HubSpot\Client\Marketing\Events\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Marketing\Events\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php similarity index 93% rename from codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php rename to codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php index 8956680a7..7cf2849b5 100644 --- a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php +++ b/codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseSearchPublicResponseWrapperNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implement * * @var string */ - protected static $openAPIModelName = 'CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; + protected static $openAPIModelName = 'CollectionResponseSearchPublicResponseWrapperNoPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implement * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[]' + 'results' => '\HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[]' ]; /** @@ -295,7 +295,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[] + * @return \HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[] */ public function getResults() { @@ -305,7 +305,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[] $results results + * @param \HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[] $results results * * @return self */ diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php new file mode 100644 index 000000000..9371aeb78 --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php @@ -0,0 +1,449 @@ + + */ +class CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total' => 'total', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CrmPropertyWrapper.php b/codegen/Marketing/Events/Model/CrmPropertyWrapper.php new file mode 100644 index 000000000..5501e1de3 --- /dev/null +++ b/codegen/Marketing/Events/Model/CrmPropertyWrapper.php @@ -0,0 +1,449 @@ + + */ +class CrmPropertyWrapper implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CrmPropertyWrapper'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php index 6b89ec804..e1a65d34f 100644 --- a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php @@ -66,7 +66,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => 'string', 'event_type' => 'string', 'event_completed' => 'bool', - 'end_date_time' => '\DateTime' + 'end_date_time' => '\DateTime', + 'object_id' => 'string' ]; /** @@ -86,7 +87,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => null, 'event_type' => null, 'event_completed' => null, - 'end_date_time' => 'date-time' + 'end_date_time' => 'date-time', + 'object_id' => null ]; /** @@ -104,7 +106,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => false, 'event_type' => false, 'event_completed' => false, - 'end_date_time' => false + 'end_date_time' => false, + 'object_id' => false ]; /** @@ -202,7 +205,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'eventName', 'event_type' => 'eventType', 'event_completed' => 'eventCompleted', - 'end_date_time' => 'endDateTime' + 'end_date_time' => 'endDateTime', + 'object_id' => 'objectId' ]; /** @@ -220,7 +224,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'setEventName', 'event_type' => 'setEventType', 'event_completed' => 'setEventCompleted', - 'end_date_time' => 'setEndDateTime' + 'end_date_time' => 'setEndDateTime', + 'object_id' => 'setObjectId' ]; /** @@ -238,7 +243,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'getEventName', 'event_type' => 'getEventType', 'event_completed' => 'getEventCompleted', - 'end_date_time' => 'getEndDateTime' + 'end_date_time' => 'getEndDateTime', + 'object_id' => 'getObjectId' ]; /** @@ -308,6 +314,7 @@ public function __construct(array $data = null) $this->setIfExists('event_type', $data ?? [], null); $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); } /** @@ -627,6 +634,33 @@ public function setEndDateTime($end_date_time) return $this; } + + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php index 6fe365ec0..323768eb9 100644 --- a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php @@ -410,7 +410,7 @@ public function getInteractionDateTime() /** * Sets interaction_date_time * - * @param int $interaction_date_time The date and time at which the contact subscribed to the event. + * @param int $interaction_date_time Timestamp in milliseconds at which the contact subscribed to the event. * * @return self */ diff --git a/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php b/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php new file mode 100644 index 000000000..16f5024ab --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php @@ -0,0 +1,554 @@ + + */ +class MarketingEventIdentifiersResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventIdentifiersResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_account_id' => 'string', + 'external_event_id' => 'string', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'object_id' => 'string', + 'marketing_event_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_account_id' => null, + 'external_event_id' => null, + 'app_info' => null, + 'object_id' => null, + 'marketing_event_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_account_id' => false, + 'external_event_id' => false, + 'app_info' => false, + 'object_id' => false, + 'marketing_event_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_account_id' => 'externalAccountId', + 'external_event_id' => 'externalEventId', + 'app_info' => 'appInfo', + 'object_id' => 'objectId', + 'marketing_event_name' => 'marketingEventName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_account_id' => 'setExternalAccountId', + 'external_event_id' => 'setExternalEventId', + 'app_info' => 'setAppInfo', + 'object_id' => 'setObjectId', + 'marketing_event_name' => 'setMarketingEventName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_account_id' => 'getExternalAccountId', + 'external_event_id' => 'getExternalEventId', + 'app_info' => 'getAppInfo', + 'object_id' => 'getObjectId', + 'marketing_event_name' => 'getMarketingEventName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('external_account_id', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('marketing_event_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_event_id'] === null) { + $invalidProperties[] = "'external_event_id' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['marketing_event_name'] === null) { + $invalidProperties[] = "'marketing_event_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_account_id + * + * @return string|null + */ + public function getExternalAccountId() + { + return $this->container['external_account_id']; + } + + /** + * Sets external_account_id + * + * @param string|null $external_account_id external_account_id + * + * @return self + */ + public function setExternalAccountId($external_account_id) + { + if (is_null($external_account_id)) { + throw new \InvalidArgumentException('non-nullable external_account_id cannot be null'); + } + $this->container['external_account_id'] = $external_account_id; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets marketing_event_name + * + * @return string + */ + public function getMarketingEventName() + { + return $this->container['marketing_event_name']; + } + + /** + * Sets marketing_event_name + * + * @param string $marketing_event_name marketing_event_name + * + * @return self + */ + public function setMarketingEventName($marketing_event_name) + { + if (is_null($marketing_event_name)) { + throw new \InvalidArgumentException('non-nullable marketing_event_name cannot be null'); + } + $this->container['marketing_event_name'] = $marketing_event_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php index 3ca1d7c7b..1697e1704 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php @@ -69,6 +69,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => 'string', 'event_name' => 'string', 'id' => 'string', + 'object_id' => 'string', 'updated_at' => '\DateTime' ]; @@ -92,6 +93,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => null, 'event_name' => null, 'id' => null, + 'object_id' => null, 'updated_at' => 'date-time' ]; @@ -113,6 +115,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => false, 'event_name' => false, 'id' => false, + 'object_id' => false, 'updated_at' => false ]; @@ -214,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'id' => 'id', + 'object_id' => 'objectId', 'updated_at' => 'updatedAt' ]; @@ -235,6 +239,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'id' => 'setId', + 'object_id' => 'setObjectId', 'updated_at' => 'setUpdatedAt' ]; @@ -256,6 +261,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'id' => 'getId', + 'object_id' => 'getObjectId', 'updated_at' => 'getUpdatedAt' ]; @@ -328,6 +334,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -712,6 +719,33 @@ public function setId($id) return $this; } + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** * Gets updated_at * diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php new file mode 100644 index 000000000..7e088213a --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php @@ -0,0 +1,866 @@ + + */ +class MarketingEventPublicDefaultResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicDefaultResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_organizer' => 'string', + 'event_url' => 'string', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'event_type' => 'string', + 'event_completed' => 'bool', + 'end_date_time' => '\DateTime', + 'created_at' => '\DateTime', + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[]', + 'event_cancelled' => 'bool', + 'event_description' => 'string', + 'event_name' => 'string', + 'object_id' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_organizer' => null, + 'event_url' => null, + 'app_info' => null, + 'event_type' => null, + 'event_completed' => null, + 'end_date_time' => 'date-time', + 'created_at' => 'date-time', + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_description' => null, + 'event_name' => null, + 'object_id' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_organizer' => false, + 'event_url' => false, + 'app_info' => false, + 'event_type' => false, + 'event_completed' => false, + 'end_date_time' => false, + 'created_at' => false, + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_description' => false, + 'event_name' => false, + 'object_id' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'app_info' => 'appInfo', + 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', + 'end_date_time' => 'endDateTime', + 'created_at' => 'createdAt', + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'object_id' => 'objectId', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'app_info' => 'setAppInfo', + 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', + 'end_date_time' => 'setEndDateTime', + 'created_at' => 'setCreatedAt', + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'object_id' => 'setObjectId', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'app_info' => 'getAppInfo', + 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', + 'end_date_time' => 'getEndDateTime', + 'created_at' => 'getCreatedAt', + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'object_id' => 'getObjectId', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php b/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php new file mode 100644 index 000000000..e94a31f5a --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php @@ -0,0 +1,412 @@ + + */ +class MarketingEventPublicObjectIdDeleteRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicObjectIdDeleteRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php index 8d583b15b..aa1c80da1 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php @@ -74,6 +74,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => 'string', 'event_name' => 'string', 'id' => 'string', + 'object_id' => 'string', 'updated_at' => '\DateTime' ]; @@ -102,6 +103,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => null, 'event_name' => null, 'id' => null, + 'object_id' => null, 'updated_at' => 'date-time' ]; @@ -128,6 +130,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => false, 'event_name' => false, 'id' => false, + 'object_id' => false, 'updated_at' => false ]; @@ -234,6 +237,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'id' => 'id', + 'object_id' => 'objectId', 'updated_at' => 'updatedAt' ]; @@ -260,6 +264,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'id' => 'setId', + 'object_id' => 'setObjectId', 'updated_at' => 'setUpdatedAt' ]; @@ -286,6 +291,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'id' => 'getId', + 'object_id' => 'getObjectId', 'updated_at' => 'getUpdatedAt' ]; @@ -363,6 +369,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -897,6 +904,33 @@ public function setId($id) return $this; } + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** * Gets updated_at * diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php new file mode 100644 index 000000000..363f917f3 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php @@ -0,0 +1,1070 @@ + + */ +class MarketingEventPublicReadResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicReadResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'registrants' => 'int', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'attendees' => 'int', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'event_type' => 'string', + 'event_completed' => 'bool', + 'end_date_time' => '\DateTime', + 'no_shows' => 'int', + 'cancellations' => 'int', + 'created_at' => '\DateTime', + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[]', + 'event_cancelled' => 'bool', + 'external_event_id' => 'string', + 'event_status' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'object_id' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'registrants' => 'int32', + 'event_organizer' => null, + 'event_url' => null, + 'attendees' => 'int32', + 'app_info' => null, + 'event_type' => null, + 'event_completed' => null, + 'end_date_time' => 'date-time', + 'no_shows' => 'int32', + 'cancellations' => 'int32', + 'created_at' => 'date-time', + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'external_event_id' => null, + 'event_status' => null, + 'event_description' => null, + 'event_name' => null, + 'object_id' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'registrants' => false, + 'event_organizer' => false, + 'event_url' => false, + 'attendees' => false, + 'app_info' => false, + 'event_type' => false, + 'event_completed' => false, + 'end_date_time' => false, + 'no_shows' => false, + 'cancellations' => false, + 'created_at' => false, + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'external_event_id' => false, + 'event_status' => false, + 'event_description' => false, + 'event_name' => false, + 'object_id' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'registrants' => 'registrants', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'attendees' => 'attendees', + 'app_info' => 'appInfo', + 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', + 'end_date_time' => 'endDateTime', + 'no_shows' => 'noShows', + 'cancellations' => 'cancellations', + 'created_at' => 'createdAt', + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'external_event_id' => 'externalEventId', + 'event_status' => 'eventStatus', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'object_id' => 'objectId', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'registrants' => 'setRegistrants', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'attendees' => 'setAttendees', + 'app_info' => 'setAppInfo', + 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', + 'end_date_time' => 'setEndDateTime', + 'no_shows' => 'setNoShows', + 'cancellations' => 'setCancellations', + 'created_at' => 'setCreatedAt', + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'external_event_id' => 'setExternalEventId', + 'event_status' => 'setEventStatus', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'object_id' => 'setObjectId', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'registrants' => 'getRegistrants', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'attendees' => 'getAttendees', + 'app_info' => 'getAppInfo', + 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', + 'end_date_time' => 'getEndDateTime', + 'no_shows' => 'getNoShows', + 'cancellations' => 'getCancellations', + 'created_at' => 'getCreatedAt', + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'external_event_id' => 'getExternalEventId', + 'event_status' => 'getEventStatus', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'object_id' => 'getObjectId', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('registrants', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('attendees', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('no_shows', $data ?? [], null); + $this->setIfExists('cancellations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('event_status', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets registrants + * + * @return int|null + */ + public function getRegistrants() + { + return $this->container['registrants']; + } + + /** + * Sets registrants + * + * @param int|null $registrants registrants + * + * @return self + */ + public function setRegistrants($registrants) + { + if (is_null($registrants)) { + throw new \InvalidArgumentException('non-nullable registrants cannot be null'); + } + $this->container['registrants'] = $registrants; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets attendees + * + * @return int|null + */ + public function getAttendees() + { + return $this->container['attendees']; + } + + /** + * Sets attendees + * + * @param int|null $attendees attendees + * + * @return self + */ + public function setAttendees($attendees) + { + if (is_null($attendees)) { + throw new \InvalidArgumentException('non-nullable attendees cannot be null'); + } + $this->container['attendees'] = $attendees; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets no_shows + * + * @return int|null + */ + public function getNoShows() + { + return $this->container['no_shows']; + } + + /** + * Sets no_shows + * + * @param int|null $no_shows no_shows + * + * @return self + */ + public function setNoShows($no_shows) + { + if (is_null($no_shows)) { + throw new \InvalidArgumentException('non-nullable no_shows cannot be null'); + } + $this->container['no_shows'] = $no_shows; + + return $this; + } + + /** + * Gets cancellations + * + * @return int|null + */ + public function getCancellations() + { + return $this->container['cancellations']; + } + + /** + * Sets cancellations + * + * @param int|null $cancellations cancellations + * + * @return self + */ + public function setCancellations($cancellations) + { + if (is_null($cancellations)) { + throw new \InvalidArgumentException('non-nullable cancellations cannot be null'); + } + $this->container['cancellations'] = $cancellations; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string|null + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string|null $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets event_status + * + * @return string|null + */ + public function getEventStatus() + { + return $this->container['event_status']; + } + + /** + * Sets event_status + * + * @param string|null $event_status event_status + * + * @return self + */ + public function setEventStatus($event_status) + { + if (is_null($event_status)) { + throw new \InvalidArgumentException('non-nullable event_status cannot be null'); + } + $this->container['event_status'] = $event_status; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php new file mode 100644 index 000000000..f81739485 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php @@ -0,0 +1,721 @@ + + */ +class MarketingEventPublicUpdateRequestFullV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicUpdateRequestFullV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\PropertyValue[]', + 'event_cancelled' => 'bool', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'event_type' => 'string', + 'end_date_time' => '\DateTime', + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_organizer' => null, + 'event_url' => null, + 'event_description' => null, + 'event_name' => null, + 'event_type' => null, + 'end_date_time' => 'date-time', + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_organizer' => false, + 'event_url' => false, + 'event_description' => false, + 'event_name' => false, + 'event_type' => false, + 'end_date_time' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'event_type' => 'eventType', + 'end_date_time' => 'endDateTime', + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'event_type' => 'setEventType', + 'end_date_time' => 'setEndDateTime', + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'event_type' => 'getEventType', + 'end_date_time' => 'getEndDateTime', + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php new file mode 100644 index 000000000..b1beba535 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php @@ -0,0 +1,684 @@ + + */ +class MarketingEventPublicUpdateRequestV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicUpdateRequestV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\PropertyValue[]', + 'event_cancelled' => 'bool', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'event_type' => 'string', + 'end_date_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_organizer' => null, + 'event_url' => null, + 'event_description' => null, + 'event_name' => null, + 'event_type' => null, + 'end_date_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_organizer' => false, + 'event_url' => false, + 'event_description' => false, + 'event_name' => false, + 'event_type' => false, + 'end_date_time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'event_type' => 'eventType', + 'end_date_time' => 'endDateTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'event_type' => 'setEventType', + 'end_date_time' => 'setEndDateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'event_type' => 'getEventType', + 'end_date_time' => 'getEndDateTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php index c1c989c11..1888c9f2f 100644 --- a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php @@ -373,7 +373,7 @@ public function getInteractionDateTime() /** * Sets interaction_date_time * - * @param int $interaction_date_time The date and time at which the contact subscribed to the event. + * @param int $interaction_date_time Timestamp in milliseconds at which the contact subscribed to the event. * * @return self */ diff --git a/codegen/Marketing/Events/Model/PropertyValue.php b/codegen/Marketing/Events/Model/PropertyValue.php index 2e8b0ac7e..894fab15b 100644 --- a/codegen/Marketing/Events/Model/PropertyValue.php +++ b/codegen/Marketing/Events/Model/PropertyValue.php @@ -421,6 +421,7 @@ public function getModelName() public const SOURCE_MICROAPPS = 'MICROAPPS'; public const SOURCE_INTENT = 'INTENT'; public const SOURCE_PROSPECTING_AGENT = 'PROSPECTING_AGENT'; + public const SOURCE_CENTRAL_EXCHANGE_RATES = 'CENTRAL_EXCHANGE_RATES'; public const DATA_SENSITIVITY_NONE = 'none'; public const DATA_SENSITIVITY_STANDARD = 'standard'; public const DATA_SENSITIVITY_HIGH = 'high'; @@ -524,6 +525,7 @@ public function getSourceAllowableValues() self::SOURCE_MICROAPPS, self::SOURCE_INTENT, self::SOURCE_PROSPECTING_AGENT, + self::SOURCE_CENTRAL_EXCHANGE_RATES, ]; } diff --git a/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php b/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php new file mode 100644 index 000000000..306067e7a --- /dev/null +++ b/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php @@ -0,0 +1,523 @@ + + */ +class SearchPublicResponseWrapper implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SearchPublicResponseWrapper'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_account_id' => 'string', + 'external_event_id' => 'string', + 'app_id' => 'int', + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_account_id' => null, + 'external_event_id' => null, + 'app_id' => 'int32', + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_account_id' => false, + 'external_event_id' => false, + 'app_id' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_account_id' => 'externalAccountId', + 'external_event_id' => 'externalEventId', + 'app_id' => 'appId', + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_account_id' => 'setExternalAccountId', + 'external_event_id' => 'setExternalEventId', + 'app_id' => 'setAppId', + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_account_id' => 'getExternalAccountId', + 'external_event_id' => 'getExternalEventId', + 'app_id' => 'getAppId', + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('external_account_id', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_account_id'] === null) { + $invalidProperties[] = "'external_account_id' can't be null"; + } + if ($this->container['external_event_id'] === null) { + $invalidProperties[] = "'external_event_id' can't be null"; + } + if ($this->container['app_id'] === null) { + $invalidProperties[] = "'app_id' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_account_id + * + * @return string + */ + public function getExternalAccountId() + { + return $this->container['external_account_id']; + } + + /** + * Sets external_account_id + * + * @param string $external_account_id external_account_id + * + * @return self + */ + public function setExternalAccountId($external_account_id) + { + if (is_null($external_account_id)) { + throw new \InvalidArgumentException('non-nullable external_account_id cannot be null'); + } + $this->container['external_account_id'] = $external_account_id; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets app_id + * + * @return int + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param int $app_id app_id + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + +