diff --git a/codegen/Crm/Objects/PostalMail/Api/AssociationsApi.php b/codegen/Crm/Objects/PostalMail/Api/AssociationsApi.php new file mode 100644 index 00000000..9161eace --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Api/AssociationsApi.php @@ -0,0 +1,1143 @@ +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 + * + * @param int $postal_mail postal_mail (required) + * @param string $to_object_type to_object_type (required) + * @param int $to_object_id to_object_id (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archive($postal_mail, $to_object_type, $to_object_id) + { + $this->archiveWithHttpInfo($postal_mail, $to_object_type, $to_object_id); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($postal_mail, $to_object_type, $to_object_id) + { + $request = $this->archiveRequest($postal_mail, $to_object_type, $to_object_id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($postal_mail, $to_object_type, $to_object_id) + { + return $this->archiveAsyncWithHttpInfo($postal_mail, $to_object_type, $to_object_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($postal_mail, $to_object_type, $to_object_id) + { + $returnType = ''; + $request = $this->archiveRequest($postal_mail, $to_object_type, $to_object_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archive' + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($postal_mail, $to_object_type, $to_object_id) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling archive' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling archive' + ); + } + // verify the required parameter 'to_object_id' is set + if ($to_object_id === null || (is_array($to_object_id) && count($to_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_id when calling archive' + ); + } + + $resourcePath = '/crm/v4/objects/postal_mail/{postalMail}/associations/{toObjectType}/{toObjectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + // path params + if ($to_object_id !== null) { + $resourcePath = str_replace( + '{' . 'toObjectId' . '}', + ObjectSerializer::toPathValue($to_object_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create + * + * @param int $postal_mail postal_mail (required) + * @param string $to_object_type to_object_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpec[] $association_spec association_spec (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function create($postal_mail, $to_object_type, $to_object_id, $association_spec) + { + list($response) = $this->createWithHttpInfo($postal_mail, $to_object_type, $to_object_id, $association_spec); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpec[] $association_spec (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($postal_mail, $to_object_type, $to_object_id, $association_spec) + { + $request = $this->createRequest($postal_mail, $to_object_type, $to_object_id, $association_spec); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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 201: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpec[] $association_spec (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($postal_mail, $to_object_type, $to_object_id, $association_spec) + { + return $this->createAsyncWithHttpInfo($postal_mail, $to_object_type, $to_object_id, $association_spec) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpec[] $association_spec (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($postal_mail, $to_object_type, $to_object_id, $association_spec) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($postal_mail, $to_object_type, $to_object_id, $association_spec); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'create' + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpec[] $association_spec (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($postal_mail, $to_object_type, $to_object_id, $association_spec) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling create' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling create' + ); + } + // verify the required parameter 'to_object_id' is set + if ($to_object_id === null || (is_array($to_object_id) && count($to_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_id when calling create' + ); + } + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $association_spec when calling create' + ); + } + + $resourcePath = '/crm/v4/objects/postal_mail/{postalMail}/associations/{toObjectType}/{toObjectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + // path params + if ($to_object_id !== null) { + $resourcePath = str_replace( + '{' . 'toObjectId' . '}', + ObjectSerializer::toPathValue($to_object_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAll + * + * List + * + * @param int $postal_mail postal_mail (required) + * @param string $to_object_type to_object_type (required) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function getAll($postal_mail, $to_object_type, $after = null, $limit = 500) + { + list($response) = $this->getAllWithHttpInfo($postal_mail, $to_object_type, $after, $limit); + return $response; + } + + /** + * Operation getAllWithHttpInfo + * + * List + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllWithHttpInfo($postal_mail, $to_object_type, $after = null, $limit = 500) + { + $request = $this->getAllRequest($postal_mail, $to_object_type, $after, $limit); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllAsync + * + * List + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsync($postal_mail, $to_object_type, $after = null, $limit = 500) + { + return $this->getAllAsyncWithHttpInfo($postal_mail, $to_object_type, $after, $limit) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllAsyncWithHttpInfo + * + * List + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsyncWithHttpInfo($postal_mail, $to_object_type, $after = null, $limit = 500) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; + $request = $this->getAllRequest($postal_mail, $to_object_type, $after, $limit); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAll' + * + * @param int $postal_mail (required) + * @param string $to_object_type (required) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllRequest($postal_mail, $to_object_type, $after = null, $limit = 500) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling getAll' + ); + } + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling getAll' + ); + } + + $resourcePath = '/crm/v4/objects/postal_mail/{postalMail}/associations/{toObjectType}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php new file mode 100644 index 00000000..e1869294 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php @@ -0,0 +1,1791 @@ +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 + * + * Archive + * + * @param string $postal_mail postal_mail (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archive($postal_mail) + { + $this->archiveWithHttpInfo($postal_mail); + } + + /** + * Operation archiveWithHttpInfo + * + * Archive + * + * @param string $postal_mail (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($postal_mail) + { + $request = $this->archiveRequest($postal_mail); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive + * + * @param string $postal_mail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($postal_mail) + { + return $this->archiveAsyncWithHttpInfo($postal_mail) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive + * + * @param string $postal_mail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($postal_mail) + { + $returnType = ''; + $request = $this->archiveRequest($postal_mail); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archive' + * + * @param string $postal_mail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($postal_mail) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling archive' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/{postalMail}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function create($simple_public_object_input) + { + list($response) = $this->createWithHttpInfo($simple_public_object_input); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($simple_public_object_input) + { + $request = $this->createRequest($simple_public_object_input); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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 201: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($simple_public_object_input) + { + return $this->createAsyncWithHttpInfo($simple_public_object_input) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($simple_public_object_input) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + $request = $this->createRequest($simple_public_object_input); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'create' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($simple_public_object_input) + { + // verify the required parameter 'simple_public_object_input' is set + if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input when calling create' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($simple_public_object_input)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + } else { + $httpBody = $simple_public_object_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getById + * + * Read + * + * @param string $postal_mail postal_mail (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function getById($postal_mail, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + { + list($response) = $this->getByIdWithHttpInfo($postal_mail, $properties, $properties_with_history, $associations, $archived, $id_property); + return $response; + } + + /** + * Operation getByIdWithHttpInfo + * + * Read + * + * @param string $postal_mail (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getByIdWithHttpInfo($postal_mail, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + { + $request = $this->getByIdRequest($postal_mail, $properties, $properties_with_history, $associations, $archived, $id_property); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getByIdAsync + * + * Read + * + * @param string $postal_mail (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsync($postal_mail, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + { + return $this->getByIdAsyncWithHttpInfo($postal_mail, $properties, $properties_with_history, $associations, $archived, $id_property) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getByIdAsyncWithHttpInfo + * + * Read + * + * @param string $postal_mail (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsyncWithHttpInfo($postal_mail, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations'; + $request = $this->getByIdRequest($postal_mail, $properties, $properties_with_history, $associations, $archived, $id_property); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getById' + * + * @param string $postal_mail (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getByIdRequest($postal_mail, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling getById' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/{postalMail}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties, + 'properties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $associations, + 'associations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_property, + 'idProperty', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPage + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + { + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + return $response; + } + + /** + * Operation getPageWithHttpInfo + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + { + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPageAsync + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + { + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPageAsyncWithHttpInfo + * + * List + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPage' + * + * @param int $limit The maximum number of results to display per page. (optional, default to 10) + * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + { + + $resourcePath = '/crm/v3/objects/postal_mail'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties, + 'properties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $associations, + 'associations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + [] + ); + } + + // 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update + * + * @param string $postal_mail postal_mail (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function update($postal_mail, $simple_public_object_input, $id_property = null) + { + list($response) = $this->updateWithHttpInfo($postal_mail, $simple_public_object_input, $id_property); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update + * + * @param string $postal_mail (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($postal_mail, $simple_public_object_input, $id_property = null) + { + $request = $this->updateRequest($postal_mail, $simple_public_object_input, $id_property); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update + * + * @param string $postal_mail (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($postal_mail, $simple_public_object_input, $id_property = null) + { + return $this->updateAsyncWithHttpInfo($postal_mail, $simple_public_object_input, $id_property) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update + * + * @param string $postal_mail (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($postal_mail, $simple_public_object_input, $id_property = null) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + $request = $this->updateRequest($postal_mail, $simple_public_object_input, $id_property); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'update' + * + * @param string $postal_mail (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string $id_property The name of a property whose values are unique for this object type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($postal_mail, $simple_public_object_input, $id_property = null) + { + // verify the required parameter 'postal_mail' is set + if ($postal_mail === null || (is_array($postal_mail) && count($postal_mail) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $postal_mail when calling update' + ); + } + // verify the required parameter 'simple_public_object_input' is set + if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input when calling update' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/{postalMail}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_property, + 'idProperty', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($postal_mail !== null) { + $resourcePath = str_replace( + '{' . 'postalMail' . '}', + ObjectSerializer::toPathValue($postal_mail), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($simple_public_object_input)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + } else { + $httpBody = $simple_public_object_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php new file mode 100644 index 00000000..f9565c49 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php @@ -0,0 +1,1390 @@ +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 + * + * Archive a batch of postal mail by ID + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function archive($batch_input_simple_public_object_id) + { + $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + } + + /** + * Operation archiveWithHttpInfo + * + * Archive a batch of postal mail by ID + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($batch_input_simple_public_object_id) + { + $request = $this->archiveRequest($batch_input_simple_public_object_id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive a batch of postal mail by ID + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_simple_public_object_id) + { + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive a batch of postal mail by ID + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + { + $returnType = ''; + $request = $this->archiveRequest($batch_input_simple_public_object_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archive' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_simple_public_object_id) + { + // verify the required parameter 'batch_input_simple_public_object_id' is set + if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_id when calling archive' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_simple_public_object_id)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + } else { + $httpBody = $batch_input_simple_public_object_id; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input batch_input_simple_public_object_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function create($batch_input_simple_public_object_input) + { + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($batch_input_simple_public_object_input) + { + $request = $this->createRequest($batch_input_simple_public_object_input); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->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 201: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($batch_input_simple_public_object_input) + { + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + $request = $this->createRequest($batch_input_simple_public_object_input); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'create' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($batch_input_simple_public_object_input) + { + // verify the required parameter 'batch_input_simple_public_object_input' is set + if ($batch_input_simple_public_object_input === null || (is_array($batch_input_simple_public_object_input) && count($batch_input_simple_public_object_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_input when calling create' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_simple_public_object_input)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input)); + } else { + $httpBody = $batch_input_simple_public_object_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation read + * + * Read a batch of postal mail by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function read($batch_read_input_simple_public_object_id, $archived = false) + { + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + return $response; + } + + /** + * Operation readWithHttpInfo + * + * Read a batch of postal mail by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + { + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation readAsync + * + * Read a batch of postal mail by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + { + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation readAsyncWithHttpInfo + * + * Read a batch of postal mail by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'read' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set + if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_read_input_simple_public_object_id when calling read' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_read_input_simple_public_object_id)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + } else { + $httpBody = $batch_read_input_simple_public_object_id; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function update($batch_input_simple_public_object_batch_input) + { + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + { + $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($batch_input_simple_public_object_batch_input) + { + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update a batch of postal mail + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; + $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'update' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($batch_input_simple_public_object_batch_input) + { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set + if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input when calling update' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php b/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php new file mode 100644 index 00000000..64580f1d --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php @@ -0,0 +1,446 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation merge + * + * Merge two postal mail with same type + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function merge($public_merge_input) + { + list($response) = $this->mergeWithHttpInfo($public_merge_input); + return $response; + } + + /** + * Operation mergeWithHttpInfo + * + * Merge two postal mail with same type + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function mergeWithHttpInfo($public_merge_input) + { + $request = $this->mergeRequest($public_merge_input); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two postal mail with same type + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two postal mail with same type + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'merge' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input) + { + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($public_merge_input)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php new file mode 100644 index 00000000..7f01cab1 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php @@ -0,0 +1,438 @@ +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 + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error + */ + public function doSearch($public_object_search_request) + { + list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + return $response; + } + + /** + * Operation doSearchWithHttpInfo + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function doSearchWithHttpInfo($public_object_search_request) + { + $request = $this->doSearchRequest($public_object_search_request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\PostalMail\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation doSearchAsync + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsync($public_object_search_request) + { + return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation doSearchAsyncWithHttpInfo + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function doSearchAsyncWithHttpInfo($public_object_search_request) + { + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + $request = $this->doSearchRequest($public_object_search_request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'doSearch' + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function doSearchRequest($public_object_search_request) + { + // verify the required parameter 'public_object_search_request' is set + if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_object_search_request when calling doSearch' + ); + } + + $resourcePath = '/crm/v3/objects/postal_mail/search'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', '*/*'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($public_object_search_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + } else { + $httpBody = $public_object_search_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Objects/PostalMail/ApiException.php b/codegen/Crm/Objects/PostalMail/ApiException.php new file mode 100644 index 00000000..deb03edb --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen/Crm/Objects/PostalMail/Configuration.php b/codegen/Crm/Objects/PostalMail/Configuration.php new file mode 100644 index 00000000..f74888a8 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Configuration.php @@ -0,0 +1,520 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormatForQueryString Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (HubSpot\Client\Crm\Objects\PostalMail) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.hubapi.com", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + if (null === $variables) { + $variables = []; + } + + $hosts = $this->getHostSettings(); + + // check array index out of bound + if ($index < 0 || $index >= sizeof($hosts)) { + throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + } + + $host = $hosts[$index]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } +} diff --git a/codegen/Crm/Objects/PostalMail/HeaderSelector.php b/codegen/Crm/Objects/PostalMail/HeaderSelector.php new file mode 100644 index 00000000..bf4cac3c --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/HeaderSelector.php @@ -0,0 +1,107 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { + return implode(',', $jsonAccept); + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php new file mode 100644 index 00000000..1afb21f6 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php @@ -0,0 +1,356 @@ + + */ +class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociatedId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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->container['id'] = $data['id'] ?? null; + $this->container['type'] = $data['type'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type type + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php new file mode 100644 index 00000000..064bcf86 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/PostalMail/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..7a3b68e7 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php new file mode 100644 index 00000000..316afe8b --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php @@ -0,0 +1,323 @@ + + */ +class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInput[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInput[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInput[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php new file mode 100644 index 00000000..c417a7f1 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php @@ -0,0 +1,323 @@ + + */ +class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInput.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInput.php new file mode 100644 index 00000000..0d47dade --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInput.php @@ -0,0 +1,323 @@ + + */ +class BatchInputSimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput[]' + ]; + + /** + * 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 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 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->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php new file mode 100644 index 00000000..12f9140d --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php @@ -0,0 +1,419 @@ + + */ +class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchReadInputSimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties' => 'string[]', + 'properties_with_history' => 'string[]', + 'id_property' => 'string', + 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties' => null, + 'properties_with_history' => null, + 'id_property' => null, + 'inputs' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'properties' => 'properties', + 'properties_with_history' => 'propertiesWithHistory', + 'id_property' => 'idProperty', + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties' => 'setProperties', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id_property' => 'setIdProperty', + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties' => 'getProperties', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id_property' => 'getIdProperty', + '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->container['properties'] = $data['properties'] ?? null; + $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; + $this->container['id_property'] = $data['id_property'] ?? null; + $this->container['inputs'] = $data['inputs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['properties_with_history'] === null) { + $invalidProperties[] = "'properties_with_history' can't be null"; + } + 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 properties + * + * @return string[] + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param string[] $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return string[] + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param string[] $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property id_property + * + * @return self + */ + public function setIdProperty($id_property) + { + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php new file mode 100644 index 00000000..5aada94c --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php @@ -0,0 +1,520 @@ + + */ +class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $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) + { + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php new file mode 100644 index 00000000..e80b472e --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -0,0 +1,580 @@ + + */ +class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[]', + 'num_errors' => 'int', + 'errors' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\StandardError[]', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'completed_at' => '\DateTime', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'results' => null, + 'num_errors' => 'int32', + 'errors' => null, + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'completed_at' => 'date-time', + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'results' => 'results', + 'num_errors' => 'numErrors', + 'errors' => 'errors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'completed_at' => 'completedAt', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'results' => 'setResults', + 'num_errors' => 'setNumErrors', + 'errors' => 'setErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'completed_at' => 'setCompletedAt', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'results' => 'getResults', + 'num_errors' => 'getNumErrors', + 'errors' => 'getErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'completed_at' => 'getCompletedAt', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['num_errors'] = $data['num_errors'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['requested_at'] = $data['requested_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['completed_at'] = $data['completed_at'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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) + ); + } + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $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; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + 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) + { + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $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) + { + $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) + { + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * 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) + { + $this->container['completed_at'] = $completed_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) + { + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php new file mode 100644 index 00000000..009f8a9a --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php @@ -0,0 +1,353 @@ + + */ +class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseAssociatedId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\AssociatedId[]', + 'paging' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\Paging' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null, + 'paging' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults', + 'paging' => 'getPaging' + ]; + + /** + * 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->container['results'] = $data['results'] ?? null; + $this->container['paging'] = $data['paging'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociatedId[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociatedId[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\Paging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\Paging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + $this->container['paging'] = $paging; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php new file mode 100644 index 00000000..40d4423f --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -0,0 +1,353 @@ + + */ +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\MultiAssociatedObjectWithLabel[]', + 'paging' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null, + 'paging' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults', + 'paging' => 'getPaging' + ]; + + /** + * 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->container['results'] = $data['results'] ?? null; + $this->container['paging'] = $data['paging'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\MultiAssociatedObjectWithLabel[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\MultiAssociatedObjectWithLabel[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + $this->container['paging'] = $paging; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php new file mode 100644 index 00000000..3caedd5f --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -0,0 +1,353 @@ + + */ +class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[]', + 'paging' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null, + 'paging' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults', + 'paging' => 'getPaging' + ]; + + /** + * 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->container['results'] = $data['results'] ?? null; + $this->container['paging'] = $data['paging'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + $this->container['paging'] = $paging; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php new file mode 100644 index 00000000..1e85ec99 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -0,0 +1,386 @@ + + */ +class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalSimplePublicObjectForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'results' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[]', + 'paging' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging' + ]; + + /** + * 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, + 'paging' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total' => 'total', + 'results' => 'results', + 'paging' => 'paging' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'results' => 'setResults', + 'paging' => 'setPaging' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'results' => 'getResults', + 'paging' => 'getPaging' + ]; + + /** + * 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->container['total'] = $data['total'] ?? null; + $this->container['results'] = $data['results'] ?? null; + $this->container['paging'] = $data['paging'] ?? null; + } + + /** + * 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) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets paging + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + $this->container['paging'] = $paging; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/Error.php b/codegen/Crm/Objects/PostalMail/Model/Error.php new file mode 100644 index 00000000..698734f4 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/Error.php @@ -0,0 +1,509 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'correlation_id' => 'string', + 'category' => 'string', + 'sub_category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[]', + 'context' => 'array', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'correlation_id' => 'uuid', + 'category' => null, + 'sub_category' => null, + 'errors' => null, + 'context' => null, + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'correlation_id' => 'correlationId', + 'category' => 'category', + 'sub_category' => 'subCategory', + 'errors' => 'errors', + 'context' => 'context', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'correlation_id' => 'setCorrelationId', + 'category' => 'setCategory', + 'sub_category' => 'setSubCategory', + 'errors' => 'setErrors', + 'context' => 'setContext', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'correlation_id' => 'getCorrelationId', + 'category' => 'getCategory', + 'sub_category' => 'getSubCategory', + 'errors' => 'getErrors', + 'context' => 'getContext', + 'links' => 'getLinks' + ]; + + /** + * 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->container['message'] = $data['message'] ?? null; + $this->container['correlation_id'] = $data['correlation_id'] ?? null; + $this->container['category'] = $data['category'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['context'] = $data['context'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['correlation_id'] === null) { + $invalidProperties[] = "'correlation_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets correlation_id + * + * @return string + */ + public function getCorrelationId() + { + return $this->container['correlation_id']; + } + + /** + * Sets correlation_id + * + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return self + */ + public function setCorrelationId($correlation_id) + { + $this->container['correlation_id'] = $correlation_id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category The error category + * + * @return self + */ + public function setCategory($category) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * + * @return self + */ + public function setLinks($links) + { + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/ErrorCategory.php b/codegen/Crm/Objects/PostalMail/Model/ErrorCategory.php new file mode 100644 index 00000000..2da0ebf8 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/ErrorCategory.php @@ -0,0 +1,510 @@ + + */ +class ErrorCategory implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorCategory'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'http_status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'http_status' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'http_status' => 'httpStatus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'http_status' => 'setHttpStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'http_status' => 'getHttpStatus' + ]; + + /** + * 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 HTTP_STATUS__CONTINUE = 'CONTINUE'; + public const HTTP_STATUS_SWITCHING_PROTOCOLS = 'SWITCHING_PROTOCOLS'; + public const HTTP_STATUS_PROCESSING = 'PROCESSING'; + public const HTTP_STATUS_OK = 'OK'; + public const HTTP_STATUS_CREATED = 'CREATED'; + public const HTTP_STATUS_ACCEPTED = 'ACCEPTED'; + public const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 'NON_AUTHORITATIVE_INFORMATION'; + public const HTTP_STATUS_NO_CONTENT = 'NO_CONTENT'; + public const HTTP_STATUS_RESET_CONTENT = 'RESET_CONTENT'; + public const HTTP_STATUS_PARTIAL_CONTENT = 'PARTIAL_CONTENT'; + public const HTTP_STATUS_MULTI_STATUS = 'MULTI_STATUS'; + public const HTTP_STATUS_ALREADY_REPORTED = 'ALREADY_REPORTED'; + public const HTTP_STATUS_IM_USED = 'IM_USED'; + public const HTTP_STATUS_MULTIPLE_CHOICES = 'MULTIPLE_CHOICES'; + public const HTTP_STATUS_MOVED_PERMANENTLY = 'MOVED_PERMANENTLY'; + public const HTTP_STATUS_FOUND = 'FOUND'; + public const HTTP_STATUS_SEE_OTHER = 'SEE_OTHER'; + public const HTTP_STATUS_NOT_MODIFIED = 'NOT_MODIFIED'; + public const HTTP_STATUS_USE_PROXY = 'USE_PROXY'; + public const HTTP_STATUS_TEMPORARY_REDIRECT = 'TEMPORARY_REDIRECT'; + public const HTTP_STATUS_PERMANENT_REDIRECT = 'PERMANENT_REDIRECT'; + public const HTTP_STATUS_BAD_REQUEST = 'BAD_REQUEST'; + public const HTTP_STATUS_UNAUTHORIZED = 'UNAUTHORIZED'; + public const HTTP_STATUS_PAYMENT_REQUIRED = 'PAYMENT_REQUIRED'; + public const HTTP_STATUS_FORBIDDEN = 'FORBIDDEN'; + public const HTTP_STATUS_NOT_FOUND = 'NOT_FOUND'; + public const HTTP_STATUS_METHOD_NOT_ALLOWED = 'METHOD_NOT_ALLOWED'; + public const HTTP_STATUS_NOT_ACCEPTABLE = 'NOT_ACCEPTABLE'; + public const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 'PROXY_AUTHENTICATION_REQUIRED'; + public const HTTP_STATUS_REQUEST_TIMEOUT = 'REQUEST_TIMEOUT'; + public const HTTP_STATUS_CONFLICT = 'CONFLICT'; + public const HTTP_STATUS_GONE = 'GONE'; + public const HTTP_STATUS_LENGTH_REQUIRED = 'LENGTH_REQUIRED'; + public const HTTP_STATUS_PRECONDITION_FAILED = 'PRECONDITION_FAILED'; + public const HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 'REQUEST_ENTITY_TOO_LARGE'; + public const HTTP_STATUS_REQUEST_URI_TOO_LONG = 'REQUEST_URI_TOO_LONG'; + public const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 'UNSUPPORTED_MEDIA_TYPE'; + public const HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 'REQUESTED_RANGE_NOT_SATISFIABLE'; + public const HTTP_STATUS_EXPECTATION_FAILED = 'EXPECTATION_FAILED'; + public const HTTP_STATUS_IM_A_TEAPOT = 'IM_A_TEAPOT'; + public const HTTP_STATUS_MISDIRECTED_REQUEST = 'MISDIRECTED_REQUEST'; + public const HTTP_STATUS_UNPROCESSABLE_ENTITY = 'UNPROCESSABLE_ENTITY'; + public const HTTP_STATUS_LOCKED = 'LOCKED'; + public const HTTP_STATUS_FAILED_DEPENDENCY = 'FAILED_DEPENDENCY'; + public const HTTP_STATUS_UPGRADE_REQUIRED = 'UPGRADE_REQUIRED'; + public const HTTP_STATUS_PRECONDITION_REQUIRED = 'PRECONDITION_REQUIRED'; + public const HTTP_STATUS_TOO_MANY_REQUESTS = 'TOO_MANY_REQUESTS'; + public const HTTP_STATUS_REQUEST_HEADERS_FIELDS_TOO_LARGE = 'REQUEST_HEADERS_FIELDS_TOO_LARGE'; + public const HTTP_STATUS_INTERNAL_STALE_SERVICE_DISCOVERY = 'INTERNAL_STALE_SERVICE_DISCOVERY'; + public const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 'UNAVAILABLE_FOR_LEGAL_REASONS'; + public const HTTP_STATUS_MIGRATION_IN_PROGRESS = 'MIGRATION_IN_PROGRESS'; + public const HTTP_STATUS_INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR'; + public const HTTP_STATUS_NOT_IMPLEMENTED = 'NOT_IMPLEMENTED'; + public const HTTP_STATUS_BAD_GATEWAY = 'BAD_GATEWAY'; + public const HTTP_STATUS_SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE'; + public const HTTP_STATUS_GATEWAY_TIMEOUT = 'GATEWAY_TIMEOUT'; + public const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 'HTTP_VERSION_NOT_SUPPORTED'; + public const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 'VARIANT_ALSO_NEGOTIATES'; + public const HTTP_STATUS_INSUFFICIENT_STORAGE = 'INSUFFICIENT_STORAGE'; + public const HTTP_STATUS_LOOP_DETECTED = 'LOOP_DETECTED'; + public const HTTP_STATUS_NOT_EXTENDED = 'NOT_EXTENDED'; + public const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 'NETWORK_AUTHENTICATION_REQUIRED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpStatusAllowableValues() + { + return [ + self::HTTP_STATUS__CONTINUE, + self::HTTP_STATUS_SWITCHING_PROTOCOLS, + self::HTTP_STATUS_PROCESSING, + self::HTTP_STATUS_OK, + self::HTTP_STATUS_CREATED, + self::HTTP_STATUS_ACCEPTED, + self::HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION, + self::HTTP_STATUS_NO_CONTENT, + self::HTTP_STATUS_RESET_CONTENT, + self::HTTP_STATUS_PARTIAL_CONTENT, + self::HTTP_STATUS_MULTI_STATUS, + self::HTTP_STATUS_ALREADY_REPORTED, + self::HTTP_STATUS_IM_USED, + self::HTTP_STATUS_MULTIPLE_CHOICES, + self::HTTP_STATUS_MOVED_PERMANENTLY, + self::HTTP_STATUS_FOUND, + self::HTTP_STATUS_SEE_OTHER, + self::HTTP_STATUS_NOT_MODIFIED, + self::HTTP_STATUS_USE_PROXY, + self::HTTP_STATUS_TEMPORARY_REDIRECT, + self::HTTP_STATUS_PERMANENT_REDIRECT, + self::HTTP_STATUS_BAD_REQUEST, + self::HTTP_STATUS_UNAUTHORIZED, + self::HTTP_STATUS_PAYMENT_REQUIRED, + self::HTTP_STATUS_FORBIDDEN, + self::HTTP_STATUS_NOT_FOUND, + self::HTTP_STATUS_METHOD_NOT_ALLOWED, + self::HTTP_STATUS_NOT_ACCEPTABLE, + self::HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED, + self::HTTP_STATUS_REQUEST_TIMEOUT, + self::HTTP_STATUS_CONFLICT, + self::HTTP_STATUS_GONE, + self::HTTP_STATUS_LENGTH_REQUIRED, + self::HTTP_STATUS_PRECONDITION_FAILED, + self::HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE, + self::HTTP_STATUS_REQUEST_URI_TOO_LONG, + self::HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, + self::HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, + self::HTTP_STATUS_EXPECTATION_FAILED, + self::HTTP_STATUS_IM_A_TEAPOT, + self::HTTP_STATUS_MISDIRECTED_REQUEST, + self::HTTP_STATUS_UNPROCESSABLE_ENTITY, + self::HTTP_STATUS_LOCKED, + self::HTTP_STATUS_FAILED_DEPENDENCY, + self::HTTP_STATUS_UPGRADE_REQUIRED, + self::HTTP_STATUS_PRECONDITION_REQUIRED, + self::HTTP_STATUS_TOO_MANY_REQUESTS, + self::HTTP_STATUS_REQUEST_HEADERS_FIELDS_TOO_LARGE, + self::HTTP_STATUS_INTERNAL_STALE_SERVICE_DISCOVERY, + self::HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS, + self::HTTP_STATUS_MIGRATION_IN_PROGRESS, + self::HTTP_STATUS_INTERNAL_SERVER_ERROR, + self::HTTP_STATUS_NOT_IMPLEMENTED, + self::HTTP_STATUS_BAD_GATEWAY, + self::HTTP_STATUS_SERVICE_UNAVAILABLE, + self::HTTP_STATUS_GATEWAY_TIMEOUT, + self::HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED, + self::HTTP_STATUS_VARIANT_ALSO_NEGOTIATES, + self::HTTP_STATUS_INSUFFICIENT_STORAGE, + self::HTTP_STATUS_LOOP_DETECTED, + self::HTTP_STATUS_NOT_EXTENDED, + self::HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED, + ]; + } + + /** + * 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->container['name'] = $data['name'] ?? null; + $this->container['http_status'] = $data['http_status'] ?? null; + } + + /** + * 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['http_status'] === null) { + $invalidProperties[] = "'http_status' can't be null"; + } + $allowedValues = $this->getHttpStatusAllowableValues(); + if (!is_null($this->container['http_status']) && !in_array($this->container['http_status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_status', must be one of '%s'", + $this->container['http_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 name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets http_status + * + * @return string + */ + public function getHttpStatus() + { + return $this->container['http_status']; + } + + /** + * Sets http_status + * + * @param string $http_status http_status + * + * @return self + */ + public function setHttpStatus($http_status) + { + $allowedValues = $this->getHttpStatusAllowableValues(); + if (!in_array($http_status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_status', must be one of '%s'", + $http_status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['http_status'] = $http_status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php new file mode 100644 index 00000000..403f6646 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php @@ -0,0 +1,443 @@ + + */ +class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'in' => 'string', + 'code' => 'string', + 'sub_category' => 'string', + 'context' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'in' => null, + 'code' => null, + 'sub_category' => null, + 'context' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'in' => 'in', + 'code' => 'code', + 'sub_category' => 'subCategory', + 'context' => 'context' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'in' => 'setIn', + 'code' => 'setCode', + 'sub_category' => 'setSubCategory', + 'context' => 'setContext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'in' => 'getIn', + 'code' => 'getCode', + 'sub_category' => 'getSubCategory', + 'context' => 'getContext' + ]; + + /** + * 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->container['message'] = $data['message'] ?? null; + $this->container['in'] = $data['in'] ?? null; + $this->container['code'] = $data['code'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['context'] = $data['context'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' 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 message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets in + * + * @return string|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string|null $in The name of the field or parameter in which the error was found. + * + * @return self + */ + public function setIn($in) + { + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The status code associated with the error detail + * + * @return self + */ + public function setCode($code) + { + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category A specific category that contains more specific detail about the error + * + * @return self + */ + public function setSubCategory($sub_category) + { + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets context + * + * @return array|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array|null $context Context about the error condition + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/Filter.php b/codegen/Crm/Objects/PostalMail/Model/Filter.php new file mode 100644 index 00000000..8805f1ee --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/Filter.php @@ -0,0 +1,472 @@ + + */ +class Filter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Filter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'values' => 'string[]', + 'property_name' => 'string', + 'operator' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'values' => null, + 'property_name' => null, + 'operator' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'value' => 'value', + 'values' => 'values', + 'property_name' => 'propertyName', + 'operator' => 'operator' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'values' => 'setValues', + 'property_name' => 'setPropertyName', + 'operator' => 'setOperator' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'values' => 'getValues', + 'property_name' => 'getPropertyName', + 'operator' => 'getOperator' + ]; + + /** + * 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 OPERATOR_EQ = 'EQ'; + public const OPERATOR_NEQ = 'NEQ'; + public const OPERATOR_LT = 'LT'; + public const OPERATOR_LTE = 'LTE'; + public const OPERATOR_GT = 'GT'; + public const OPERATOR_GTE = 'GTE'; + public const OPERATOR_BETWEEN = 'BETWEEN'; + public const OPERATOR_IN = 'IN'; + public const OPERATOR_NOT_IN = 'NOT_IN'; + public const OPERATOR_HAS_PROPERTY = 'HAS_PROPERTY'; + public const OPERATOR_NOT_HAS_PROPERTY = 'NOT_HAS_PROPERTY'; + public const OPERATOR_CONTAINS_TOKEN = 'CONTAINS_TOKEN'; + public const OPERATOR_NOT_CONTAINS_TOKEN = 'NOT_CONTAINS_TOKEN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperatorAllowableValues() + { + return [ + self::OPERATOR_EQ, + self::OPERATOR_NEQ, + self::OPERATOR_LT, + self::OPERATOR_LTE, + self::OPERATOR_GT, + self::OPERATOR_GTE, + self::OPERATOR_BETWEEN, + self::OPERATOR_IN, + self::OPERATOR_NOT_IN, + self::OPERATOR_HAS_PROPERTY, + self::OPERATOR_NOT_HAS_PROPERTY, + self::OPERATOR_CONTAINS_TOKEN, + self::OPERATOR_NOT_CONTAINS_TOKEN, + ]; + } + + /** + * 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->container['value'] = $data['value'] ?? null; + $this->container['values'] = $data['values'] ?? null; + $this->container['property_name'] = $data['property_name'] ?? null; + $this->container['operator'] = $data['operator'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['property_name'] === null) { + $invalidProperties[] = "'property_name' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!is_null($this->container['operator']) && !in_array($this->container['operator'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operator', must be one of '%s'", + $this->container['operator'], + 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value value + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets values + * + * @return string[]|null + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param string[]|null $values values + * + * @return self + */ + public function setValues($values) + { + $this->container['values'] = $values; + + return $this; + } + + /** + * Gets property_name + * + * @return string + */ + public function getPropertyName() + { + return $this->container['property_name']; + } + + /** + * Sets property_name + * + * @param string $property_name property_name + * + * @return self + */ + public function setPropertyName($property_name) + { + $this->container['property_name'] = $property_name; + + return $this; + } + + /** + * Gets operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator null + * + * @return self + */ + public function setOperator($operator) + { + $allowedValues = $this->getOperatorAllowableValues(); + if (!in_array($operator, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operator'] = $operator; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php new file mode 100644 index 00000000..4d745fd5 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php @@ -0,0 +1,323 @@ + + */ +class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FilterGroup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filters' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\Filter[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filters' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filters' => 'getFilters' + ]; + + /** + * 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->container['filters'] = $data['filters'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['filters'] === null) { + $invalidProperties[] = "'filters' 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 filters + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\Filter[] + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\Filter[] $filters filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php new file mode 100644 index 00000000..665119ab --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php @@ -0,0 +1,320 @@ + + */ +class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'next' => 'next' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['next'] = $data['next'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets next + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + $this->container['next'] = $next; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/PostalMail/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..3b99e2f5 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * 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->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' 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 from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php new file mode 100644 index 00000000..56670e12 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php @@ -0,0 +1,95 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * 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->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' 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 to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/NextPage.php b/codegen/Crm/Objects/PostalMail/Model/NextPage.php new file mode 100644 index 00000000..78656d4f --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/NextPage.php @@ -0,0 +1,353 @@ + + */ +class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NextPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'after' => 'string', + 'link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'after' => null, + 'link' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'after' => 'after', + 'link' => 'link' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'after' => 'setAfter', + 'link' => 'setLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'after' => 'getAfter', + 'link' => 'getLink' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['after'] = $data['after'] ?? null; + $this->container['link'] = $data['link'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['after'] === null) { + $invalidProperties[] = "'after' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets after + * + * @return string + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param string $after after + * + * @return self + */ + public function setAfter($after) + { + $this->container['after'] = $after; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link link + * + * @return self + */ + public function setLink($link) + { + $this->container['link'] = $link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/Paging.php b/codegen/Crm/Objects/PostalMail/Model/Paging.php new file mode 100644 index 00000000..82b85b03 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/Paging.php @@ -0,0 +1,350 @@ + + */ +class Paging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Paging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage', + 'prev' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\PreviousPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null, + 'prev' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'next' => 'next', + 'prev' => 'prev' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext', + 'prev' => 'setPrev' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext', + 'prev' => 'getPrev' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['next'] = $data['next'] ?? null; + $this->container['prev'] = $data['prev'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets next + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + $this->container['next'] = $next; + + return $this; + } + + /** + * Gets prev + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\PreviousPage|null + */ + public function getPrev() + { + return $this->container['prev']; + } + + /** + * Sets prev + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PreviousPage|null $prev prev + * + * @return self + */ + public function setPrev($prev) + { + $this->container['prev'] = $prev; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php new file mode 100644 index 00000000..21a10fe1 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php @@ -0,0 +1,353 @@ + + */ +class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PreviousPage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'before' => 'string', + 'link' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'before' => null, + 'link' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'before' => 'before', + 'link' => 'link' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'before' => 'setBefore', + 'link' => 'setLink' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'before' => 'getBefore', + 'link' => 'getLink' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['before'] = $data['before'] ?? null; + $this->container['link'] = $data['link'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['before'] === null) { + $invalidProperties[] = "'before' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets before + * + * @return string + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param string $before before + * + * @return self + */ + public function setBefore($before) + { + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link link + * + * @return self + */ + public function setLink($link) + { + $this->container['link'] = $link; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php b/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php new file mode 100644 index 00000000..0288f5c5 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php @@ -0,0 +1,356 @@ + + */ +class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicMergeInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'primary_object_id' => 'string', + 'object_id_to_merge' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'primary_object_id' => null, + 'object_id_to_merge' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'primary_object_id' => 'primaryObjectId', + 'object_id_to_merge' => 'objectIdToMerge' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'primary_object_id' => 'setPrimaryObjectId', + 'object_id_to_merge' => 'setObjectIdToMerge' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'primary_object_id' => 'getPrimaryObjectId', + 'object_id_to_merge' => 'getObjectIdToMerge' + ]; + + /** + * 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->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['primary_object_id'] === null) { + $invalidProperties[] = "'primary_object_id' can't be null"; + } + if ($this->container['object_id_to_merge'] === null) { + $invalidProperties[] = "'object_id_to_merge' 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 primary_object_id + * + * @return string + */ + public function getPrimaryObjectId() + { + return $this->container['primary_object_id']; + } + + /** + * Sets primary_object_id + * + * @param string $primary_object_id primary_object_id + * + * @return self + */ + public function setPrimaryObjectId($primary_object_id) + { + $this->container['primary_object_id'] = $primary_object_id; + + return $this; + } + + /** + * Gets object_id_to_merge + * + * @return string + */ + public function getObjectIdToMerge() + { + return $this->container['object_id_to_merge']; + } + + /** + * Sets object_id_to_merge + * + * @param string $object_id_to_merge object_id_to_merge + * + * @return self + */ + public function setObjectIdToMerge($object_id_to_merge) + { + $this->container['object_id_to_merge'] = $object_id_to_merge; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php new file mode 100644 index 00000000..a010d537 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php @@ -0,0 +1,485 @@ + + */ +class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicObjectSearchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filter_groups' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\FilterGroup[]', + 'sorts' => 'string[]', + 'query' => 'string', + 'properties' => 'string[]', + 'limit' => 'int', + 'after' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filter_groups' => null, + 'sorts' => null, + 'query' => null, + 'properties' => null, + 'limit' => 'int32', + 'after' => 'int32' + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'filter_groups' => 'filterGroups', + 'sorts' => 'sorts', + 'query' => 'query', + 'properties' => 'properties', + 'limit' => 'limit', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filter_groups' => 'setFilterGroups', + 'sorts' => 'setSorts', + 'query' => 'setQuery', + 'properties' => 'setProperties', + 'limit' => 'setLimit', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filter_groups' => 'getFilterGroups', + 'sorts' => 'getSorts', + 'query' => 'getQuery', + 'properties' => 'getProperties', + 'limit' => 'getLimit', + 'after' => 'getAfter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->container['sorts'] = $data['sorts'] ?? null; + $this->container['query'] = $data['query'] ?? null; + $this->container['properties'] = $data['properties'] ?? null; + $this->container['limit'] = $data['limit'] ?? null; + $this->container['after'] = $data['after'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['filter_groups'] === null) { + $invalidProperties[] = "'filter_groups' can't be null"; + } + if ($this->container['sorts'] === null) { + $invalidProperties[] = "'sorts' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['limit'] === null) { + $invalidProperties[] = "'limit' can't be null"; + } + if ($this->container['after'] === null) { + $invalidProperties[] = "'after' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets filter_groups + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\FilterGroup[] + */ + public function getFilterGroups() + { + return $this->container['filter_groups']; + } + + /** + * Sets filter_groups + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\FilterGroup[] $filter_groups filter_groups + * + * @return self + */ + public function setFilterGroups($filter_groups) + { + $this->container['filter_groups'] = $filter_groups; + + return $this; + } + + /** + * Gets sorts + * + * @return string[] + */ + public function getSorts() + { + return $this->container['sorts']; + } + + /** + * Sets sorts + * + * @param string[] $sorts sorts + * + * @return self + */ + public function setSorts($sorts) + { + $this->container['sorts'] = $sorts; + + return $this; + } + + /** + * Gets query + * + * @return string|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query query + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets properties + * + * @return string[] + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param string[] $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets limit + * + * @return int + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int $limit limit + * + * @return self + */ + public function setLimit($limit) + { + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets after + * + * @return int + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param int $after after + * + * @return self + */ + public function setAfter($after) + { + $this->container['after'] = $after; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php new file mode 100644 index 00000000..52167e30 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php @@ -0,0 +1,512 @@ + + */ +class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'properties' => 'array', + 'properties_with_history' => 'array', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'properties' => null, + 'properties_with_history' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time' + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'properties' => 'properties', + 'properties_with_history' => 'propertiesWithHistory', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'properties' => 'setProperties', + 'properties_with_history' => 'setPropertiesWithHistory', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'properties' => 'getProperties', + 'properties_with_history' => 'getPropertiesWithHistory', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt' + ]; + + /** + * 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->container['id'] = $data['id'] ?? null; + $this->container['properties'] = $data['properties'] ?? null; + $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['archived'] = $data['archived'] ?? null; + $this->container['archived_at'] = $data['archived_at'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + $this->container['properties_with_history'] = $properties_with_history; + + 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) + { + $this->container['created_at'] = $created_at; + + 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) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + $this->container['archived_at'] = $archived_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php new file mode 100644 index 00000000..45732af7 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php @@ -0,0 +1,356 @@ + + */ +class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties' => 'array', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties' => null, + 'id' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'properties' => 'properties', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties' => 'setProperties', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties' => 'getProperties', + '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->container['properties'] = $data['properties'] ?? null; + $this->container['id'] = $data['id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + 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 properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + 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) + { + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php new file mode 100644 index 00000000..f2216586 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php @@ -0,0 +1,323 @@ + + */ +class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php new file mode 100644 index 00000000..0ec4947e --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php @@ -0,0 +1,323 @@ + + */ +class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['properties'] = $data['properties'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php new file mode 100644 index 00000000..8ff04ec2 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php @@ -0,0 +1,542 @@ + + */ +class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectWithAssociations'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'properties' => 'array', + 'properties_with_history' => 'array', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'associations' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'properties' => null, + 'properties_with_history' => null, + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'associations' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'properties' => 'properties', + 'properties_with_history' => 'propertiesWithHistory', + 'created_at' => 'createdAt', + 'updated_at' => 'updatedAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'associations' => 'associations' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'properties' => 'setProperties', + 'properties_with_history' => 'setPropertiesWithHistory', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'associations' => 'setAssociations' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'properties' => 'getProperties', + 'properties_with_history' => 'getPropertiesWithHistory', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'associations' => 'getAssociations' + ]; + + /** + * 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->container['id'] = $data['id'] ?? null; + $this->container['properties'] = $data['properties'] ?? null; + $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['archived'] = $data['archived'] ?? null; + $this->container['archived_at'] = $data['archived_at'] ?? null; + $this->container['associations'] = $data['associations'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + $this->container['properties_with_history'] = $properties_with_history; + + 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) + { + $this->container['created_at'] = $created_at; + + 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) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets associations + * + * @return array|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param array|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + $this->container['associations'] = $associations; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/StandardError.php b/codegen/Crm/Objects/PostalMail/Model/StandardError.php new file mode 100644 index 00000000..5428df45 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/StandardError.php @@ -0,0 +1,548 @@ + + */ +class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StandardError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'id' => 'string', + 'category' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorCategory', + 'sub_category' => 'object', + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[]', + 'context' => 'array', + 'links' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'category' => null, + 'sub_category' => null, + 'message' => null, + 'errors' => null, + 'context' => null, + 'links' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'id' => 'id', + 'category' => 'category', + 'sub_category' => 'subCategory', + 'message' => 'message', + 'errors' => 'errors', + 'context' => 'context', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'category' => 'setCategory', + 'sub_category' => 'setSubCategory', + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'context' => 'setContext', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'category' => 'getCategory', + 'sub_category' => 'getSubCategory', + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'context' => 'getContext', + 'links' => 'getLinks' + ]; + + /** + * 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->container['status'] = $data['status'] ?? null; + $this->container['id'] = $data['id'] ?? null; + $this->container['category'] = $data['category'] ?? null; + $this->container['sub_category'] = $data['sub_category'] ?? null; + $this->container['message'] = $data['message'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['context'] = $data['context'] ?? null; + $this->container['links'] = $data['links'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' 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 status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorCategory + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorCategory $category category + * + * @return self + */ + public function setCategory($category) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets sub_category + * + * @return object|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param object|null $sub_category sub_category + * + * @return self + */ + public function setSubCategory($sub_category) + { + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\ErrorDetail[] $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets context + * + * @return array + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param array $context context + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets links + * + * @return array + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array $links links + * + * @return self + */ + public function setLinks($links) + { + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php new file mode 100644 index 00000000..3733f1a9 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php @@ -0,0 +1,479 @@ + + */ +class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValueWithTimestamp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'timestamp' => '\DateTime', + 'source_type' => 'string', + 'source_id' => 'string', + 'source_label' => 'string', + 'updated_by_user_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'timestamp' => 'date-time', + 'source_type' => null, + 'source_id' => null, + 'source_label' => null, + 'updated_by_user_id' => 'int32' + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'value' => 'value', + 'timestamp' => 'timestamp', + 'source_type' => 'sourceType', + 'source_id' => 'sourceId', + 'source_label' => 'sourceLabel', + 'updated_by_user_id' => 'updatedByUserId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'timestamp' => 'setTimestamp', + 'source_type' => 'setSourceType', + 'source_id' => 'setSourceId', + 'source_label' => 'setSourceLabel', + 'updated_by_user_id' => 'setUpdatedByUserId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'timestamp' => 'getTimestamp', + 'source_type' => 'getSourceType', + 'source_id' => 'getSourceId', + 'source_label' => 'getSourceLabel', + 'updated_by_user_id' => 'getUpdatedByUserId' + ]; + + /** + * 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->container['value'] = $data['value'] ?? null; + $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->container['source_type'] = $data['source_type'] ?? null; + $this->container['source_id'] = $data['source_id'] ?? null; + $this->container['source_label'] = $data['source_label'] ?? null; + $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['timestamp'] === null) { + $invalidProperties[] = "'timestamp' can't be null"; + } + if ($this->container['source_type'] === null) { + $invalidProperties[] = "'source_type' 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 value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets timestamp + * + * @return \DateTime + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param \DateTime $timestamp timestamp + * + * @return self + */ + public function setTimestamp($timestamp) + { + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets source_type + * + * @return string + */ + public function getSourceType() + { + return $this->container['source_type']; + } + + /** + * Sets source_type + * + * @param string $source_type source_type + * + * @return self + */ + public function setSourceType($source_type) + { + $this->container['source_type'] = $source_type; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets source_label + * + * @return string|null + */ + public function getSourceLabel() + { + return $this->container['source_label']; + } + + /** + * Sets source_label + * + * @param string|null $source_label source_label + * + * @return self + */ + public function setSourceLabel($source_label) + { + $this->container['source_label'] = $source_label; + + return $this; + } + + /** + * Gets updated_by_user_id + * + * @return int|null + */ + public function getUpdatedByUserId() + { + return $this->container['updated_by_user_id']; + } + + /** + * Sets updated_by_user_id + * + * @param int|null $updated_by_user_id updated_by_user_id + * + * @return self + */ + public function setUpdatedByUserId($updated_by_user_id) + { + $this->container['updated_by_user_id'] = $updated_by_user_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/ObjectSerializer.php b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php new file mode 100644 index 00000000..f0600d49 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php @@ -0,0 +1,504 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + if ( + empty($value) + && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty + ) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some API's return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\HubSpot\Client\Crm\Objects\PostalMail\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +}