diff --git a/codegen/Crm/Objects/Api/AssociationsApi.php b/codegen/Crm/Objects/Api/AssociationsApi.php index 21d2623b..9108519c 100644 --- a/codegen/Crm/Objects/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Api/AssociationsApi.php @@ -1,29 +1,28 @@ archiveAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -157,6 +153,7 @@ public function archiveAssociationWithHttpInfo($object_type, $object_id, $associ } return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -166,26 +163,23 @@ public function archiveAssociationWithHttpInfo($object_type, $object_id, $associ $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation archiveAssociationAsync. + * Operation archiveAssociationAsync * * Remove an association between two objects * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function archiveAssociationAsync($object_type, $object_id, $associated_object_type, $to_object_id) @@ -195,22 +189,20 @@ public function archiveAssociationAsync($object_type, $object_id, $associated_ob function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation archiveAssociationAsyncWithHttpInfo. + * Operation archiveAssociationAsyncWithHttpInfo * * Remove an association between two objects * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function archiveAssociationAsyncWithHttpInfo($object_type, $object_id, $associated_object_type, $to_object_id) @@ -227,7 +219,6 @@ function ($response) use ($returnType) { function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -239,55 +230,201 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'archiveAssociation' + * + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function archiveAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling archiveAssociation' + ); + } + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling archiveAssociation' + ); + } + // verify the required parameter 'associated_object_type' is set + if ($associated_object_type === null || (is_array($associated_object_type) && count($associated_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $associated_object_type when calling archiveAssociation' + ); + } + // 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 archiveAssociation' + ); + } + + $resourcePath = '/{objectType}/{objectId}/associations/{associatedObjectType}/{toObjectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($associated_object_type !== null) { + $resourcePath = str_replace( + '{' . 'associatedObjectType' . '}', + ObjectSerializer::toPathValue($associated_object_type), + $resourcePath + ); + } + // path params + if ($to_object_id !== null) { + $resourcePath = str_replace( + '{' . 'toObjectId' . '}', + ObjectSerializer::toPathValue($to_object_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation createAssociation. + * Operation createAssociation * * Associate two objects * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) - * @param string $associated_object_type associated_object_type (required) - * @param string $to_object_id to_object_id (required) + * @param string $object_type object_type (required) + * @param string $object_id object_id (required) + * @param string $associated_object_type associated_object_type (required) + * @param string $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ public function createAssociation($object_type, $object_id, $associated_object_type, $to_object_id) { list($response) = $this->createAssociationWithHttpInfo($object_type, $object_id, $associated_object_type, $to_object_id); - return $response; } /** - * Operation createAssociationWithHttpInfo. + * Operation createAssociationWithHttpInfo * * Associate two objects * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function createAssociationWithHttpInfo($object_type, $object_id, $associated_object_type, $to_object_id) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; $request = $this->createAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -315,20 +452,47 @@ public function createAssociationWithHttpInfo($object_type, $object_id, $associa } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\SimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -338,7 +502,6 @@ public function createAssociationWithHttpInfo($object_type, $object_id, $associa $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -347,26 +510,23 @@ public function createAssociationWithHttpInfo($object_type, $object_id, $associa $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation createAssociationAsync. + * Operation createAssociationAsync * * Associate two objects * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function createAssociationAsync($object_type, $object_id, $associated_object_type, $to_object_id) @@ -376,22 +536,20 @@ public function createAssociationAsync($object_type, $object_id, $associated_obj function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation createAssociationAsyncWithHttpInfo. + * Operation createAssociationAsyncWithHttpInfo * * Associate two objects * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function createAssociationAsyncWithHttpInfo($object_type, $object_id, $associated_object_type, $to_object_id) @@ -404,25 +562,21 @@ public function createAssociationAsyncWithHttpInfo($object_type, $object_id, $as ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -434,56 +588,202 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); } /** - * Operation getAssociations. - * - * List associations of an object by type + * Create request for operation 'createAssociation' * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) - * @param string $associated_object_type associated_object_type (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * @param string $to_object_id (required) * - * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId + * @return \GuzzleHttp\Psr7\Request */ - public function getAssociations($object_type, $object_id, $associated_object_type) + protected function createAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id) { - list($response) = $this->getAssociationsWithHttpInfo($object_type, $object_id, $associated_object_type); + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling createAssociation' + ); + } + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling createAssociation' + ); + } + // verify the required parameter 'associated_object_type' is set + if ($associated_object_type === null || (is_array($associated_object_type) && count($associated_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $associated_object_type when calling createAssociation' + ); + } + // 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 createAssociation' + ); + } - return $response; - } + $resourcePath = '/{objectType}/{objectId}/associations/{associatedObjectType}/{toObjectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; - /** - * Operation getAssociationsWithHttpInfo. - * - * List associations of an object by type - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * - * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response - * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId, HTTP status code, HTTP response headers (array of strings) - */ - public function getAssociationsWithHttpInfo($object_type, $object_id, $associated_object_type) - { - $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId'; - $request = $this->getAssociationsRequest($object_type, $object_id, $associated_object_type); - try { - $options = $this->createHttpClientOption(); + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($associated_object_type !== null) { + $resourcePath = str_replace( + '{' . 'associatedObjectType' . '}', + ObjectSerializer::toPathValue($associated_object_type), + $resourcePath + ); + } + // path params + if ($to_object_id !== null) { + $resourcePath = str_replace( + '{' . 'toObjectId' . '}', + ObjectSerializer::toPathValue($to_object_id), + $resourcePath + ); + } - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAssociations + * + * List associations of an object by type + * + * @param string $object_type object_type (required) + * @param string $object_id object_id (required) + * @param string $associated_object_type associated_object_type (required) + * + * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId|\HubSpot\Client\Crm\Objects\Model\Error + */ + public function getAssociations($object_type, $object_id, $associated_object_type) + { + list($response) = $this->getAssociationsWithHttpInfo($object_type, $object_id, $associated_object_type); + return $response; + } + + /** + * Operation getAssociationsWithHttpInfo + * + * List associations of an object by type + * + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) + * + * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAssociationsWithHttpInfo($object_type, $object_id, $associated_object_type) + { + $request = $this->getAssociationsRequest($object_type, $object_id, $associated_object_type); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), @@ -508,20 +808,47 @@ public function getAssociationsWithHttpInfo($object_type, $object_id, $associate } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectId'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -531,7 +858,6 @@ public function getAssociationsWithHttpInfo($object_type, $object_id, $associate $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -540,25 +866,22 @@ public function getAssociationsWithHttpInfo($object_type, $object_id, $associate $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation getAssociationsAsync. + * Operation getAssociationsAsync * * List associations of an object by type * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function getAssociationsAsync($object_type, $object_id, $associated_object_type) @@ -568,21 +891,19 @@ public function getAssociationsAsync($object_type, $object_id, $associated_objec function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation getAssociationsAsyncWithHttpInfo. + * Operation getAssociationsAsyncWithHttpInfo * * List associations of an object by type * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function getAssociationsAsyncWithHttpInfo($object_type, $object_id, $associated_object_type) @@ -595,25 +916,21 @@ public function getAssociationsAsyncWithHttpInfo($object_type, $object_id, $asso ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -625,339 +942,35 @@ function ($exception) { $response->getBody() ); } - ) - ; - } - - /** - * Create request for operation 'archiveAssociation'. - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function archiveAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archiveAssociation' - ); - } - // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling archiveAssociation' - ); - } - // verify the required parameter 'associated_object_type' is set - if (null === $associated_object_type || (is_array($associated_object_type) && 0 === count($associated_object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $associated_object_type when calling archiveAssociation' - ); - } - // verify the required parameter 'to_object_id' is set - if (null === $to_object_id || (is_array($to_object_id) && 0 === count($to_object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $to_object_id when calling archiveAssociation' - ); - } - - $resourcePath = '/{objectType}/{objectId}/associations/{associatedObjectType}/{toObjectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if (null !== $object_id) { - $resourcePath = str_replace( - '{'.'objectId'.'}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - // path params - if (null !== $associated_object_type) { - $resourcePath = str_replace( - '{'.'associatedObjectType'.'}', - ObjectSerializer::toPathValue($associated_object_type), - $resourcePath - ); - } - // path params - if (null !== $to_object_id) { - $resourcePath = str_replace( - '{'.'toObjectId'.'}', - ObjectSerializer::toPathValue($to_object_id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'DELETE', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'createAssociation'. - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) - * @param string $to_object_id (required) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function createAssociationRequest($object_type, $object_id, $associated_object_type, $to_object_id) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling createAssociation' - ); - } - // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling createAssociation' - ); - } - // verify the required parameter 'associated_object_type' is set - if (null === $associated_object_type || (is_array($associated_object_type) && 0 === count($associated_object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $associated_object_type when calling createAssociation' - ); - } - // verify the required parameter 'to_object_id' is set - if (null === $to_object_id || (is_array($to_object_id) && 0 === count($to_object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $to_object_id when calling createAssociation' - ); - } - - $resourcePath = '/{objectType}/{objectId}/associations/{associatedObjectType}/{toObjectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if (null !== $object_id) { - $resourcePath = str_replace( - '{'.'objectId'.'}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - // path params - if (null !== $associated_object_type) { - $resourcePath = str_replace( - '{'.'associatedObjectType'.'}', - ObjectSerializer::toPathValue($associated_object_type), - $resourcePath - ); - } - // path params - if (null !== $to_object_id) { - $resourcePath = str_replace( - '{'.'toObjectId'.'}', - ObjectSerializer::toPathValue($to_object_id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'PUT', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); } /** - * Create request for operation 'getAssociations'. + * Create request for operation 'getAssociations' * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string $associated_object_type (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param string $associated_object_type (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Psr7\Request */ protected function getAssociationsRequest($object_type, $object_id, $associated_object_type) { // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $object_type when calling getAssociations' ); } // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $object_id when calling getAssociations' ); } // verify the required parameter 'associated_object_type' is set - if (null === $associated_object_type || (is_array($associated_object_type) && 0 === count($associated_object_type))) { + if ($associated_object_type === null || (is_array($associated_object_type) && count($associated_object_type) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $associated_object_type when calling getAssociations' ); @@ -970,26 +983,27 @@ protected function getAssociationsRequest($object_type, $object_id, $associated_ $httpBody = ''; $multipart = false; + // path params - if (null !== $object_type) { + if ($object_type !== null) { $resourcePath = str_replace( - '{'.'objectType'.'}', + '{' . 'objectType' . '}', ObjectSerializer::toPathValue($object_type), $resourcePath ); } // path params - if (null !== $object_id) { + if ($object_id !== null) { $resourcePath = str_replace( - '{'.'objectId'.'}', + '{' . 'objectId' . '}', ObjectSerializer::toPathValue($object_id), $resourcePath ); } // path params - if (null !== $associated_object_type) { + if ($associated_object_type !== null) { $resourcePath = str_replace( - '{'.'associatedObjectType'.'}', + '{' . 'associatedObjectType' . '}', ObjectSerializer::toPathValue($associated_object_type), $resourcePath ); @@ -1005,17 +1019,17 @@ protected function getAssociationsRequest($object_type, $object_id, $associated_ } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1023,13 +1037,15 @@ protected function getAssociationsRequest($object_type, $object_id, $associated_ foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, - 'contents' => $formParamValue, + 'contents' => $formParamValue ]; } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { + + } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); @@ -1038,12 +1054,12 @@ protected function getAssociationsRequest($object_type, $object_id, $associated_ // this endpoint requires API key authentication $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { + if ($apiKey !== null) { $queryParams['hapikey'] = $apiKey; } // this endpoint requires OAuth (access token) - if (null !== $this->config->getAccessToken()) { - $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken(); + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; @@ -1058,20 +1074,18 @@ protected function getAssociationsRequest($object_type, $object_id, $associated_ ); $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( 'GET', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Create http client option. + * Create http client option * * @throws \RuntimeException on file opening failure - * * @return array of http client options */ protected function createHttpClientOption() @@ -1080,7 +1094,7 @@ protected function createHttpClientOption() 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()); + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } diff --git a/codegen/Crm/Objects/Api/BasicApi.php b/codegen/Crm/Objects/Api/BasicApi.php index ac891b2b..8389138e 100644 --- a/codegen/Crm/Objects/Api/BasicApi.php +++ b/codegen/Crm/Objects/Api/BasicApi.php @@ -1,29 +1,28 @@ archiveRequest($object_type, $object_id); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -153,6 +149,7 @@ public function archiveWithHttpInfo($object_type, $object_id) } return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -162,24 +159,21 @@ public function archiveWithHttpInfo($object_type, $object_id) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation archiveAsync. + * Operation archiveAsync * * Archive * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function archiveAsync($object_type, $object_id) @@ -189,20 +183,18 @@ public function archiveAsync($object_type, $object_id) function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation archiveAsyncWithHttpInfo. + * Operation archiveAsyncWithHttpInfo * * Archive * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ public function archiveAsyncWithHttpInfo($object_type, $object_id) @@ -219,7 +211,6 @@ function ($response) use ($returnType) { function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -231,51 +222,167 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'archive' + * + * @param string $object_type (required) + * @param string $object_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function archiveRequest($object_type, $object_id) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling archive' + ); + } + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling archive' + ); + } + + $resourcePath = '/{objectType}/{objectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation create. + * Operation create * * Create * - * @param string $object_type object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body body (optional) + * @param string $object_type object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function create($object_type, $body = null) + public function create($object_type, $simple_public_object_input = null) { - list($response) = $this->createWithHttpInfo($object_type, $body); - + list($response) = $this->createWithHttpInfo($object_type, $simple_public_object_input); return $response; } /** - * Operation createWithHttpInfo. + * Operation createWithHttpInfo * * Create * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($object_type, $body = null) + public function createWithHttpInfo($object_type, $simple_public_object_input = null) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; - $request = $this->createRequest($object_type, $body); + $request = $this->createRequest($object_type, $simple_public_object_input); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -303,20 +410,47 @@ public function createWithHttpInfo($object_type, $body = null) } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 201: + if ('\HubSpot\Client\Crm\Objects\Model\SimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -326,7 +460,6 @@ public function createWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -335,78 +468,69 @@ public function createWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation createAsync. + * Operation createAsync * * Create * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($object_type, $body = null) + public function createAsync($object_type, $simple_public_object_input = null) { - return $this->createAsyncWithHttpInfo($object_type, $body) + return $this->createAsyncWithHttpInfo($object_type, $simple_public_object_input) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation createAsyncWithHttpInfo. + * Operation createAsyncWithHttpInfo * * Create * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($object_type, $body = null) + public function createAsyncWithHttpInfo($object_type, $simple_public_object_input = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; - $request = $this->createRequest($object_type, $body); + $request = $this->createRequest($object_type, $simple_public_object_input); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -418,57 +542,162 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'create' + * + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createRequest($object_type, $simple_public_object_input = null) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling create' + ); + } + + $resourcePath = '/{objectType}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($simple_public_object_input)) { + $_tempBody = $simple_public_object_input; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation getById. + * Operation getById * * Read * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list 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 $object_type object_type (required) + * @param string $object_id object_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list 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\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function getById($object_type, $object_id, $properties = null, $associations = null, $archived = 'false') + public function getById($object_type, $object_id, $properties = null, $associations = null, $archived = false) { list($response) = $this->getByIdWithHttpInfo($object_type, $object_id, $properties, $associations, $archived); - return $response; } /** - * Operation getByIdWithHttpInfo. + * Operation getByIdWithHttpInfo * * Read * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list 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 $object_type (required) + * @param string $object_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list 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\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($object_type, $object_id, $properties = null, $associations = null, $archived = 'false') + public function getByIdWithHttpInfo($object_type, $object_id, $properties = null, $associations = null, $archived = false) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; $request = $this->getByIdRequest($object_type, $object_id, $properties, $associations, $archived); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -496,20 +725,47 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { - $content = $responseBody; //stream goes to serializer - } else { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\SimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -519,7 +775,6 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -528,56 +783,51 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation getByIdAsync. + * Operation getByIdAsync * * Read * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list 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 $object_type (required) + * @param string $object_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list 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 getByIdAsync($object_type, $object_id, $properties = null, $associations = null, $archived = 'false') + public function getByIdAsync($object_type, $object_id, $properties = null, $associations = null, $archived = false) { return $this->getByIdAsyncWithHttpInfo($object_type, $object_id, $properties, $associations, $archived) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation getByIdAsyncWithHttpInfo. + * Operation getByIdAsyncWithHttpInfo * * Read * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list 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 $object_type (required) + * @param string $object_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list 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 getByIdAsyncWithHttpInfo($object_type, $object_id, $properties = null, $associations = null, $archived = 'false') + public function getByIdAsyncWithHttpInfo($object_type, $object_id, $properties = null, $associations = null, $archived = false) { $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; $request = $this->getByIdRequest($object_type, $object_id, $properties, $associations, $archived); @@ -587,25 +837,21 @@ public function getByIdAsyncWithHttpInfo($object_type, $object_id, $properties = ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -617,59 +863,196 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'getById' + * + * @param string $object_type (required) + * @param string $object_id (required) + * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[] $associations A comma separated list 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 + */ + protected function getByIdRequest($object_type, $object_id, $properties = null, $associations = null, $archived = false) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling getById' + ); + } + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling getById' + ); + } + + $resourcePath = '/{objectType}/{objectId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($properties)) { + $properties = ObjectSerializer::serializeCollection($properties, 'multi', true); + } + if ($properties !== null) { + $queryParams['properties'] = ObjectSerializer::toQueryValue($properties); + } + // query params + if (is_array($associations)) { + $associations = ObjectSerializer::serializeCollection($associations, 'multi', true); + } + if ($associations !== null) { + $queryParams['associations'] = ObjectSerializer::toQueryValue($associations); + } + // query params + if ($archived !== null) { + $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); + } + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation getPage. + * Operation getPage * * List * - * @param string $object_type object_type (required) - * @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[] $associations A comma separated list 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 $object_type object_type (required) + * @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[] $associations A comma separated list 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\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function getPage($object_type, $limit = '10', $after = null, $properties = null, $associations = null, $archived = 'false') + public function getPage($object_type, $limit = 10, $after = null, $properties = null, $associations = null, $archived = false) { list($response) = $this->getPageWithHttpInfo($object_type, $limit, $after, $properties, $associations, $archived); - return $response; } /** - * Operation getPageWithHttpInfo. + * Operation getPageWithHttpInfo * * List * - * @param string $object_type (required) - * @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[] $associations A comma separated list 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 $object_type (required) + * @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[] $associations A comma separated list 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\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($object_type, $limit = '10', $after = null, $properties = null, $associations = null, $archived = 'false') + public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $associations = null, $archived = false) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject'; $request = $this->getPageRequest($object_type, $limit, $after, $properties, $associations, $archived); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -697,20 +1080,47 @@ public function getPageWithHttpInfo($object_type, $limit = '10', $after = null, } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -720,7 +1130,6 @@ public function getPageWithHttpInfo($object_type, $limit = '10', $after = null, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -729,58 +1138,53 @@ public function getPageWithHttpInfo($object_type, $limit = '10', $after = null, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation getPageAsync. + * Operation getPageAsync * * List * - * @param string $object_type (required) - * @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[] $associations A comma separated list 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 $object_type (required) + * @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[] $associations A comma separated list 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($object_type, $limit = '10', $after = null, $properties = null, $associations = null, $archived = 'false') + public function getPageAsync($object_type, $limit = 10, $after = null, $properties = null, $associations = null, $archived = false) { return $this->getPageAsyncWithHttpInfo($object_type, $limit, $after, $properties, $associations, $archived) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation getPageAsyncWithHttpInfo. + * Operation getPageAsyncWithHttpInfo * * List * - * @param string $object_type (required) - * @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[] $associations A comma separated list 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 $object_type (required) + * @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[] $associations A comma separated list 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($object_type, $limit = '10', $after = null, $properties = null, $associations = null, $archived = 'false') + public function getPageAsyncWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $associations = null, $archived = false) { $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObject'; $request = $this->getPageRequest($object_type, $limit, $after, $properties, $associations, $archived); @@ -790,25 +1194,21 @@ public function getPageAsyncWithHttpInfo($object_type, $limit = '10', $after = n ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -820,63 +1220,195 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); } /** - * Operation update. + * Create request for operation 'getPage' * - * Update - * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body body (optional) + * @param string $object_type (required) + * @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[] $associations A comma separated list 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\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject + * @return \GuzzleHttp\Psr7\Request */ - public function update($object_type, $object_id, $body = null) + protected function getPageRequest($object_type, $limit = 10, $after = null, $properties = null, $associations = null, $archived = false) { - list($response) = $this->updateWithHttpInfo($object_type, $object_id, $body); + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling getPage' + ); + } - return $response; - } + $resourcePath = '/{objectType}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; - /** - * Operation updateWithHttpInfo. - * - * Update - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) - * - * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response - * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject, HTTP status code, HTTP response headers (array of strings) - */ - public function updateWithHttpInfo($object_type, $object_id, $body = null) - { - $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; - $request = $this->updateRequest($object_type, $object_id, $body); + // query params + if ($limit !== null) { + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + } + // query params + if ($after !== null) { + $queryParams['after'] = ObjectSerializer::toQueryValue($after); + } + // query params + if (is_array($properties)) { + $properties = ObjectSerializer::serializeCollection($properties, 'multi', true); + } + if ($properties !== null) { + $queryParams['properties'] = ObjectSerializer::toQueryValue($properties); + } + // query params + if (is_array($associations)) { + $associations = ObjectSerializer::serializeCollection($associations, 'multi', true); + } + if ($associations !== null) { + $queryParams['associations'] = ObjectSerializer::toQueryValue($associations); + } + // query params + if ($archived !== null) { + $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); + } - try { - $options = $this->createHttpClientOption(); + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update + * + * @param string $object_type object_type (required) + * @param string $object_id object_id (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (optional) + * + * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error + */ + public function update($object_type, $object_id, $simple_public_object_input = null) + { + list($response) = $this->updateWithHttpInfo($object_type, $object_id, $simple_public_object_input); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update + * + * @param string $object_type (required) + * @param string $object_id (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) + * + * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($object_type, $object_id, $simple_public_object_input = null) + { + $request = $this->updateRequest($object_type, $object_id, $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()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } $statusCode = $response->getStatusCode(); @@ -894,20 +1426,47 @@ public function updateWithHttpInfo($object_type, $object_id, $body = null) } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\SimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -917,7 +1476,6 @@ public function updateWithHttpInfo($object_type, $object_id, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -926,80 +1484,71 @@ public function updateWithHttpInfo($object_type, $object_id, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation updateAsync. + * Operation updateAsync * * Update * - * @param string $object_type (required) - * @param string $object_id (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param string $object_id (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($object_type, $object_id, $body = null) + public function updateAsync($object_type, $object_id, $simple_public_object_input = null) { - return $this->updateAsyncWithHttpInfo($object_type, $object_id, $body) + return $this->updateAsyncWithHttpInfo($object_type, $object_id, $simple_public_object_input) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation updateAsyncWithHttpInfo. + * Operation updateAsyncWithHttpInfo * * Update * - * @param string $object_type (required) - * @param string $object_id (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param string $object_id (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($object_type, $object_id, $body = null) + public function updateAsyncWithHttpInfo($object_type, $object_id, $simple_public_object_input = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; - $request = $this->updateRequest($object_type, $object_id, $body); + $request = $this->updateRequest($object_type, $object_id, $simple_public_object_input); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -1011,32 +1560,31 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); } /** - * Create request for operation 'archive'. + * Create request for operation 'update' * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Psr7\Request */ - protected function archiveRequest($object_type, $object_id) + protected function updateRequest($object_type, $object_id, $simple_public_object_input = null) { // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archive' + 'Missing the required parameter $object_type when calling update' ); } // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling archive' + 'Missing the required parameter $object_id when calling update' ); } @@ -1047,18 +1595,19 @@ protected function archiveRequest($object_type, $object_id) $httpBody = ''; $multipart = false; + // path params - if (null !== $object_type) { + if ($object_type !== null) { $resourcePath = str_replace( - '{'.'objectType'.'}', + '{' . 'objectType' . '}', ObjectSerializer::toPathValue($object_type), $resourcePath ); } // path params - if (null !== $object_id) { + if ($object_id !== null) { $resourcePath = str_replace( - '{'.'objectId'.'}', + '{' . 'objectId' . '}', ObjectSerializer::toPathValue($object_id), $resourcePath ); @@ -1066,115 +1615,8 @@ protected function archiveRequest($object_type, $object_id) // body params $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'DELETE', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'create'. - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function createRequest($object_type, $body = null) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling create' - ); - } - - $resourcePath = '/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; + if (isset($simple_public_object_input)) { + $_tempBody = $simple_public_object_input; } if ($multipart) { @@ -1191,10 +1633,10 @@ protected function createRequest($object_type, $body = null) // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1202,13 +1644,15 @@ protected function createRequest($object_type, $body = null) foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, - 'contents' => $formParamValue, + 'contents' => $formParamValue ]; } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { + + } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); @@ -1217,12 +1661,12 @@ protected function createRequest($object_type, $body = null) // this endpoint requires API key authentication $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { + if ($apiKey !== null) { $queryParams['hapikey'] = $apiKey; } // this endpoint requires OAuth (access token) - if (null !== $this->config->getAccessToken()) { - $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken(); + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; @@ -1237,426 +1681,18 @@ protected function createRequest($object_type, $body = null) ); $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Create request for operation 'getById'. - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list 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 - */ - protected function getByIdRequest($object_type, $object_id, $properties = null, $associations = null, $archived = 'false') - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getById' - ); - } - // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getById' - ); - } - - $resourcePath = '/{objectType}/{objectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if (is_array($properties)) { - $properties = ObjectSerializer::serializeCollection($properties, 'multi', true); - } - if (null !== $properties) { - $queryParams['properties'] = ObjectSerializer::toQueryValue($properties); - } - // query params - if (is_array($associations)) { - $associations = ObjectSerializer::serializeCollection($associations, 'multi', true); - } - if (null !== $associations) { - $queryParams['associations'] = ObjectSerializer::toQueryValue($associations); - } - // query params - if (null !== $archived) { - $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); - } - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if (null !== $object_id) { - $resourcePath = str_replace( - '{'.'objectId'.'}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'GET', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'getPage'. - * - * @param string $object_type (required) - * @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[] $associations A comma separated list 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 - */ - protected function getPageRequest($object_type, $limit = '10', $after = null, $properties = null, $associations = null, $archived = 'false') - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling getPage' - ); - } - - $resourcePath = '/{objectType}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if (null !== $limit) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); - } - // query params - if (null !== $after) { - $queryParams['after'] = ObjectSerializer::toQueryValue($after); - } - // query params - if (is_array($properties)) { - $properties = ObjectSerializer::serializeCollection($properties, 'multi', true); - } - if (null !== $properties) { - $queryParams['properties'] = ObjectSerializer::toQueryValue($properties); - } - // query params - if (is_array($associations)) { - $associations = ObjectSerializer::serializeCollection($associations, 'multi', true); - } - if (null !== $associations) { - $queryParams['associations'] = ObjectSerializer::toQueryValue($associations); - } - // query params - if (null !== $archived) { - $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); - } - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'GET', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'update'. - * - * @param string $object_type (required) - * @param string $object_id (required) - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $body (optional) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateRequest($object_type, $object_id, $body = null) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' - ); - } - // verify the required parameter 'object_id' is set - if (null === $object_id || (is_array($object_id) && 0 === count($object_id))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling update' - ); - } - - $resourcePath = '/{objectType}/{objectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - // path params - if (null !== $object_id) { - $resourcePath = str_replace( - '{'.'objectId'.'}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'PATCH', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option. + * Create http client option * * @throws \RuntimeException on file opening failure - * * @return array of http client options */ protected function createHttpClientOption() @@ -1665,7 +1701,7 @@ protected function createHttpClientOption() 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()); + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } diff --git a/codegen/Crm/Objects/Api/BatchApi.php b/codegen/Crm/Objects/Api/BatchApi.php index 2b8d5cfd..f426612f 100644 --- a/codegen/Crm/Objects/Api/BatchApi.php +++ b/codegen/Crm/Objects/Api/BatchApi.php @@ -1,29 +1,28 @@ archiveBatchWithHttpInfo($object_type, $body); + $this->archiveBatchWithHttpInfo($object_type, $batch_input_simple_public_object_id); } /** - * Operation archiveBatchWithHttpInfo. + * Operation archiveBatchWithHttpInfo * * Archive a batch of objects by ID * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveBatchWithHttpInfo($object_type, $body = null) + public function archiveBatchWithHttpInfo($object_type, $batch_input_simple_public_object_id = null) { - $returnType = ''; - $request = $this->archiveBatchRequest($object_type, $body); + $request = $this->archiveBatchRequest($object_type, $batch_input_simple_public_object_id); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -153,6 +149,7 @@ public function archiveBatchWithHttpInfo($object_type, $body = null) } return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -162,53 +159,48 @@ public function archiveBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation archiveBatchAsync. + * Operation archiveBatchAsync * * Archive a batch of objects by ID * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveBatchAsync($object_type, $body = null) + public function archiveBatchAsync($object_type, $batch_input_simple_public_object_id = null) { - return $this->archiveBatchAsyncWithHttpInfo($object_type, $body) + return $this->archiveBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_id) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation archiveBatchAsyncWithHttpInfo. + * Operation archiveBatchAsyncWithHttpInfo * * Archive a batch of objects by ID * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveBatchAsyncWithHttpInfo($object_type, $body = null) + public function archiveBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_id = null) { $returnType = ''; - $request = $this->archiveBatchRequest($object_type, $body); + $request = $this->archiveBatchRequest($object_type, $batch_input_simple_public_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -219,7 +211,6 @@ function ($response) use ($returnType) { function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -231,51 +222,156 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'archiveBatch' + * + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function archiveBatchRequest($object_type, $batch_input_simple_public_object_id = null) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling archiveBatch' + ); + } + + $resourcePath = '/{objectType}/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($batch_input_simple_public_object_id)) { + $_tempBody = $batch_input_simple_public_object_id; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation createBatch. + * Operation createBatch * * Create a batch of objects * - * @param string $object_type object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $body body (optional) + * @param string $object_type object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input batch_input_simple_public_object_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function createBatch($object_type, $body = null) + public function createBatch($object_type, $batch_input_simple_public_object_input = null) { - list($response) = $this->createBatchWithHttpInfo($object_type, $body); - + list($response) = $this->createBatchWithHttpInfo($object_type, $batch_input_simple_public_object_input); return $response; } /** - * Operation createBatchWithHttpInfo. + * Operation createBatchWithHttpInfo * * Create a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createBatchWithHttpInfo($object_type, $body = null) + public function createBatchWithHttpInfo($object_type, $batch_input_simple_public_object_input = null) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->createBatchRequest($object_type, $body); + $request = $this->createBatchRequest($object_type, $batch_input_simple_public_object_input); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -303,20 +399,59 @@ public function createBatchWithHttpInfo($object_type, $body = null) } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 201: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -326,7 +461,6 @@ public function createBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; case 207: $data = ObjectSerializer::deserialize( @@ -335,7 +469,6 @@ public function createBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -344,78 +477,69 @@ public function createBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation createBatchAsync. + * Operation createBatchAsync * * Create a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchAsync($object_type, $body = null) + public function createBatchAsync($object_type, $batch_input_simple_public_object_input = null) { - return $this->createBatchAsyncWithHttpInfo($object_type, $body) + return $this->createBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_input) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation createBatchAsyncWithHttpInfo. + * Operation createBatchAsyncWithHttpInfo * * Create a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchAsyncWithHttpInfo($object_type, $body = null) + public function createBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_input = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->createBatchRequest($object_type, $body); + $request = $this->createBatchRequest($object_type, $batch_input_simple_public_object_input); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -427,53 +551,158 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); + } + + /** + * Create request for operation 'createBatch' + * + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $batch_input_simple_public_object_input (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createBatchRequest($object_type, $batch_input_simple_public_object_input = null) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling createBatch' + ); + } + + $resourcePath = '/{objectType}/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($batch_input_simple_public_object_input)) { + $_tempBody = $batch_input_simple_public_object_input; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation readBatch. + * Operation readBatch * * Read a batch of objects by ID * - * @param string $object_type object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $body body (optional) + * @param string $object_type object_type (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function readBatch($object_type, $archived = 'false', $body = null) + public function readBatch($object_type, $archived = false, $batch_read_input_simple_public_object_id = null) { - list($response) = $this->readBatchWithHttpInfo($object_type, $archived, $body); - + list($response) = $this->readBatchWithHttpInfo($object_type, $archived, $batch_read_input_simple_public_object_id); return $response; } /** - * Operation readBatchWithHttpInfo. + * Operation readBatchWithHttpInfo * * Read a batch of objects by ID * - * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readBatchWithHttpInfo($object_type, $archived = 'false', $body = null) + public function readBatchWithHttpInfo($object_type, $archived = false, $batch_read_input_simple_public_object_id = null) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->readBatchRequest($object_type, $archived, $body); + $request = $this->readBatchRequest($object_type, $archived, $batch_read_input_simple_public_object_id); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -501,20 +730,59 @@ public function readBatchWithHttpInfo($object_type, $archived = 'false', $body = } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { - $content = $responseBody; //stream goes to serializer - } else { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -524,7 +792,6 @@ public function readBatchWithHttpInfo($object_type, $archived = 'false', $body = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; case 207: $data = ObjectSerializer::deserialize( @@ -533,7 +800,6 @@ public function readBatchWithHttpInfo($object_type, $archived = 'false', $body = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -542,80 +808,71 @@ public function readBatchWithHttpInfo($object_type, $archived = 'false', $body = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation readBatchAsync. + * Operation readBatchAsync * * Read a batch of objects by ID * - * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readBatchAsync($object_type, $archived = 'false', $body = null) + public function readBatchAsync($object_type, $archived = false, $batch_read_input_simple_public_object_id = null) { - return $this->readBatchAsyncWithHttpInfo($object_type, $archived, $body) + return $this->readBatchAsyncWithHttpInfo($object_type, $archived, $batch_read_input_simple_public_object_id) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation readBatchAsyncWithHttpInfo. + * Operation readBatchAsyncWithHttpInfo * * Read a batch of objects by ID * - * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readBatchAsyncWithHttpInfo($object_type, $archived = 'false', $body = null) + public function readBatchAsyncWithHttpInfo($object_type, $archived = false, $batch_read_input_simple_public_object_id = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->readBatchRequest($object_type, $archived, $body); + $request = $this->readBatchRequest($object_type, $archived, $batch_read_input_simple_public_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -627,51 +884,161 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); } /** - * Operation updateBatch. + * Create request for operation 'readBatch' + * + * @param string $object_type (required) + * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function readBatchRequest($object_type, $archived = false, $batch_read_input_simple_public_object_id = null) + { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_type when calling readBatch' + ); + } + + $resourcePath = '/{objectType}/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($archived !== null) { + $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); + } + + // path params + if ($object_type !== null) { + $resourcePath = str_replace( + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($batch_read_input_simple_public_object_id)) { + $_tempBody = $batch_read_input_simple_public_object_id; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // 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 = \GuzzleHttp\Psr7\build_query($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 ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateBatch * * Update a batch of objects * - * @param string $object_type object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $body body (optional) + * @param string $object_type object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function updateBatch($object_type, $body = null) + public function updateBatch($object_type, $batch_input_simple_public_object_batch_input = null) { - list($response) = $this->updateBatchWithHttpInfo($object_type, $body); - + list($response) = $this->updateBatchWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input); return $response; } /** - * Operation updateBatchWithHttpInfo. + * Operation updateBatchWithHttpInfo * * Update a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateBatchWithHttpInfo($object_type, $body = null) + public function updateBatchWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input = null) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->updateBatchRequest($object_type, $body); + $request = $this->updateBatchRequest($object_type, $batch_input_simple_public_object_batch_input); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -699,20 +1066,59 @@ public function updateBatchWithHttpInfo($object_type, $body = null) } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -722,7 +1128,6 @@ public function updateBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; case 207: $data = ObjectSerializer::deserialize( @@ -731,7 +1136,6 @@ public function updateBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -740,78 +1144,69 @@ public function updateBatchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation updateBatchAsync. + * Operation updateBatchAsync * * Update a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateBatchAsync($object_type, $body = null) + public function updateBatchAsync($object_type, $batch_input_simple_public_object_batch_input = null) { - return $this->updateBatchAsyncWithHttpInfo($object_type, $body) + return $this->updateBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation updateBatchAsyncWithHttpInfo. + * Operation updateBatchAsyncWithHttpInfo * * Update a batch of objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateBatchAsyncWithHttpInfo($object_type, $body = null) + public function updateBatchAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->updateBatchRequest($object_type, $body); + $request = $this->updateBatchRequest($object_type, $batch_input_simple_public_object_batch_input); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -823,360 +1218,22 @@ function ($exception) { $response->getBody() ); } - ) - ; - } - - /** - * Create request for operation 'archiveBatch'. - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $body (optional) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function archiveBatchRequest($object_type, $body = null) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling archiveBatch' - ); - } - - $resourcePath = '/{objectType}/batch/archive'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'createBatch'. - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInput $body (optional) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function createBatchRequest($object_type, $body = null) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling createBatch' - ); - } - - $resourcePath = '/{objectType}/batch/create'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); } /** - * Create request for operation 'readBatch'. + * Create request for operation 'updateBatch' * - * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Psr7\Request */ - protected function readBatchRequest($object_type, $archived = 'false', $body = null) + protected function updateBatchRequest($object_type, $batch_input_simple_public_object_batch_input = null) { // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling readBatch' - ); - } - - $resourcePath = '/{objectType}/batch/read'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - if (null !== $archived) { - $queryParams['archived'] = ObjectSerializer::toQueryValue($archived); - } - - // path params - if (null !== $object_type) { - $resourcePath = str_replace( - '{'.'objectType'.'}', - ObjectSerializer::toPathValue($object_type), - $resourcePath - ); - } - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { - $queryParams['hapikey'] = $apiKey; - } - // this endpoint requires OAuth (access token) - if (null !== $this->config->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 = \GuzzleHttp\Psr7\build_query($queryParams); - - return new Request( - 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create request for operation 'updateBatch'. - * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $body (optional) - * - * @throws \InvalidArgumentException - * - * @return \GuzzleHttp\Psr7\Request - */ - protected function updateBatchRequest($object_type, $body = null) - { - // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $object_type when calling updateBatch' ); @@ -1189,10 +1246,11 @@ protected function updateBatchRequest($object_type, $body = null) $httpBody = ''; $multipart = false; + // path params - if (null !== $object_type) { + if ($object_type !== null) { $resourcePath = str_replace( - '{'.'objectType'.'}', + '{' . 'objectType' . '}', ObjectSerializer::toPathValue($object_type), $resourcePath ); @@ -1200,8 +1258,8 @@ protected function updateBatchRequest($object_type, $body = null) // body params $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; + if (isset($batch_input_simple_public_object_batch_input)) { + $_tempBody = $batch_input_simple_public_object_batch_input; } if ($multipart) { @@ -1218,10 +1276,10 @@ protected function updateBatchRequest($object_type, $body = null) // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1229,13 +1287,15 @@ protected function updateBatchRequest($object_type, $body = null) foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, - 'contents' => $formParamValue, + 'contents' => $formParamValue ]; } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { + + } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); @@ -1244,12 +1304,12 @@ protected function updateBatchRequest($object_type, $body = null) // this endpoint requires API key authentication $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { + if ($apiKey !== null) { $queryParams['hapikey'] = $apiKey; } // this endpoint requires OAuth (access token) - if (null !== $this->config->getAccessToken()) { - $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken(); + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; @@ -1264,20 +1324,18 @@ protected function updateBatchRequest($object_type, $body = null) ); $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Create http client option. + * Create http client option * * @throws \RuntimeException on file opening failure - * * @return array of http client options */ protected function createHttpClientOption() @@ -1286,7 +1344,7 @@ protected function createHttpClientOption() 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()); + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } diff --git a/codegen/Crm/Objects/Api/SearchApi.php b/codegen/Crm/Objects/Api/SearchApi.php index f3891aad..96bdc882 100644 --- a/codegen/Crm/Objects/Api/SearchApi.php +++ b/codegen/Crm/Objects/Api/SearchApi.php @@ -1,29 +1,28 @@ doSearchWithHttpInfo($object_type, $body); - + list($response) = $this->doSearchWithHttpInfo($object_type, $public_object_search_request); return $response; } /** - * Operation doSearchWithHttpInfo. + * Operation doSearchWithHttpInfo * * Filter, Sort, and Search CRM Objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (optional) * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response * @throws \InvalidArgumentException - * - * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($object_type, $body = null) + public function doSearchWithHttpInfo($object_type, $public_object_search_request = null) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject'; - $request = $this->doSearchRequest($object_type, $body); + $request = $this->doSearchRequest($object_type, $public_object_search_request); try { $options = $this->createHttpClientOption(); - try { $response = $this->client->send($request, $options); } catch (RequestException $e) { @@ -157,20 +150,47 @@ public function doSearchWithHttpInfo($object_type, $body = null) } $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Model\Error' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; + } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -180,7 +200,6 @@ public function doSearchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( @@ -189,78 +208,69 @@ public function doSearchWithHttpInfo($object_type, $body = null) $e->getResponseHeaders() ); $e->setResponseObject($data); - break; } - throw $e; } } /** - * Operation doSearchAsync. + * Operation doSearchAsync * * Filter, Sort, and Search CRM Objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($object_type, $body = null) + public function doSearchAsync($object_type, $public_object_search_request = null) { - return $this->doSearchAsyncWithHttpInfo($object_type, $body) + return $this->doSearchAsyncWithHttpInfo($object_type, $public_object_search_request) ->then( function ($response) { return $response[0]; } - ) - ; + ); } /** - * Operation doSearchAsyncWithHttpInfo. + * Operation doSearchAsyncWithHttpInfo * * Filter, Sort, and Search CRM Objects * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($object_type, $body = null) + public function doSearchAsyncWithHttpInfo($object_type, $public_object_search_request = null) { $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseWithTotalSimplePublicObject'; - $request = $this->doSearchRequest($object_type, $body); + $request = $this->doSearchRequest($object_type, $public_object_search_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); - if ('\SplFileObject' === $returnType) { + if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== $returnType) { - $content = json_decode($content); - } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), - $response->getHeaders(), + $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); - throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', @@ -272,24 +282,22 @@ function ($exception) { $response->getBody() ); } - ) - ; + ); } /** - * Create request for operation 'doSearch'. + * Create request for operation 'doSearch' * - * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $body (optional) + * @param string $object_type (required) + * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (optional) * * @throws \InvalidArgumentException - * * @return \GuzzleHttp\Psr7\Request */ - protected function doSearchRequest($object_type, $body = null) + protected function doSearchRequest($object_type, $public_object_search_request = null) { // verify the required parameter 'object_type' is set - if (null === $object_type || (is_array($object_type) && 0 === count($object_type))) { + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $object_type when calling doSearch' ); @@ -302,10 +310,11 @@ protected function doSearchRequest($object_type, $body = null) $httpBody = ''; $multipart = false; + // path params - if (null !== $object_type) { + if ($object_type !== null) { $resourcePath = str_replace( - '{'.'objectType'.'}', + '{' . 'objectType' . '}', ObjectSerializer::toPathValue($object_type), $resourcePath ); @@ -313,8 +322,8 @@ protected function doSearchRequest($object_type, $body = null) // body params $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; + if (isset($public_object_search_request)) { + $_tempBody = $public_object_search_request; } if ($multipart) { @@ -331,10 +340,10 @@ protected function doSearchRequest($object_type, $body = null) // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -342,13 +351,15 @@ protected function doSearchRequest($object_type, $body = null) foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, - 'contents' => $formParamValue, + 'contents' => $formParamValue ]; } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ('application/json' === $headers['Content-Type']) { + + } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); @@ -357,12 +368,12 @@ protected function doSearchRequest($object_type, $body = null) // this endpoint requires API key authentication $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if (null !== $apiKey) { + if ($apiKey !== null) { $queryParams['hapikey'] = $apiKey; } // this endpoint requires OAuth (access token) - if (null !== $this->config->getAccessToken()) { - $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken(); + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; @@ -377,20 +388,18 @@ protected function doSearchRequest($object_type, $body = null) ); $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( 'POST', - $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** - * Create http client option. + * Create http client option * * @throws \RuntimeException on file opening failure - * * @return array of http client options */ protected function createHttpClientOption() @@ -399,7 +408,7 @@ protected function createHttpClientOption() 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()); + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } diff --git a/codegen/Crm/Objects/ApiException.php b/codegen/Crm/Objects/ApiException.php index 2986e118..34ef64a9 100644 --- a/codegen/Crm/Objects/ApiException.php +++ b/codegen/Crm/Objects/ApiException.php @@ -1,47 +1,46 @@ responseHeaders = $responseHeaders; @@ -79,9 +78,9 @@ public function __construct($message = '', $code = 0, $responseHeaders = [], $re } /** - * Gets the HTTP response header. + * Gets the HTTP response header * - * @return null|string[] HTTP response header + * @return string[]|null HTTP response header */ public function getResponseHeaders() { @@ -89,7 +88,7 @@ public function getResponseHeaders() } /** - * Gets the HTTP body of the server response either as Json or string. + * Gets the HTTP body of the server response either as Json or string * * @return mixed HTTP body of the server response either as \stdClass or string */ @@ -99,9 +98,11 @@ public function getResponseBody() } /** - * Sets the deseralized response object (during deserialization). + * Sets the deseralized response object (during deserialization) * * @param mixed $obj Deserialized response object + * + * @return void */ public function setResponseObject($obj) { @@ -109,7 +110,7 @@ public function setResponseObject($obj) } /** - * Gets the deseralized response object (during deserialization). + * Gets the deseralized response object (during deserialization) * * @return mixed the deserialized response object */ diff --git a/codegen/Crm/Objects/Configuration.php b/codegen/Crm/Objects/Configuration.php index f46565f7..ca886cea 100644 --- a/codegen/Crm/Objects/Configuration.php +++ b/codegen/Crm/Objects/Configuration.php @@ -1,29 +1,28 @@ apiKeys[$apiKeyIdentifier] = $key; - return $this; } /** - * Gets API key. + * Gets API key * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * @@ -148,7 +146,7 @@ public function getApiKey($apiKeyIdentifier) } /** - * Sets the prefix for API key (e.g. Bearer). + * 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 @@ -158,12 +156,11 @@ public function getApiKey($apiKeyIdentifier) public function setApiKeyPrefix($apiKeyIdentifier, $prefix) { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; } /** - * Gets API key prefix. + * Gets API key prefix * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * @@ -175,7 +172,7 @@ public function getApiKeyPrefix($apiKeyIdentifier) } /** - * Sets the access token for OAuth. + * Sets the access token for OAuth * * @param string $accessToken Token for OAuth * @@ -184,12 +181,11 @@ public function getApiKeyPrefix($apiKeyIdentifier) public function setAccessToken($accessToken) { $this->accessToken = $accessToken; - return $this; } /** - * Gets the access token for OAuth. + * Gets the access token for OAuth * * @return string Access token for OAuth */ @@ -199,7 +195,7 @@ public function getAccessToken() } /** - * Sets the username for HTTP basic authentication. + * Sets the username for HTTP basic authentication * * @param string $username Username for HTTP basic authentication * @@ -208,12 +204,11 @@ public function getAccessToken() public function setUsername($username) { $this->username = $username; - return $this; } /** - * Gets the username for HTTP basic authentication. + * Gets the username for HTTP basic authentication * * @return string Username for HTTP basic authentication */ @@ -223,7 +218,7 @@ public function getUsername() } /** - * Sets the password for HTTP basic authentication. + * Sets the password for HTTP basic authentication * * @param string $password Password for HTTP basic authentication * @@ -232,12 +227,11 @@ public function getUsername() public function setPassword($password) { $this->password = $password; - return $this; } /** - * Gets the password for HTTP basic authentication. + * Gets the password for HTTP basic authentication * * @return string Password for HTTP basic authentication */ @@ -247,7 +241,7 @@ public function getPassword() } /** - * Sets the host. + * Sets the host * * @param string $host Host * @@ -256,12 +250,11 @@ public function getPassword() public function setHost($host) { $this->host = $host; - return $this; } /** - * Gets the host. + * Gets the host * * @return string Host */ @@ -271,12 +264,11 @@ public function getHost() } /** - * Sets the user agent of the api client. + * 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) @@ -286,12 +278,11 @@ public function setUserAgent($userAgent) } $this->userAgent = $userAgent; - return $this; } /** - * Gets the user agent of the api client. + * Gets the user agent of the api client * * @return string user agent */ @@ -301,7 +292,7 @@ public function getUserAgent() } /** - * Sets debug flag. + * Sets debug flag * * @param bool $debug Debug flag * @@ -310,12 +301,11 @@ public function getUserAgent() public function setDebug($debug) { $this->debug = $debug; - return $this; } /** - * Gets the debug flag. + * Gets the debug flag * * @return bool */ @@ -325,7 +315,7 @@ public function getDebug() } /** - * Sets the debug file. + * Sets the debug file * * @param string $debugFile Debug file * @@ -334,12 +324,11 @@ public function getDebug() public function setDebugFile($debugFile) { $this->debugFile = $debugFile; - return $this; } /** - * Gets the debug file. + * Gets the debug file * * @return string */ @@ -349,7 +338,7 @@ public function getDebugFile() } /** - * Sets the temp folder path. + * Sets the temp folder path * * @param string $tempFolderPath Temp folder path * @@ -358,12 +347,11 @@ public function getDebugFile() public function setTempFolderPath($tempFolderPath) { $this->tempFolderPath = $tempFolderPath; - return $this; } /** - * Gets the temp folder path. + * Gets the temp folder path * * @return string Temp folder path */ @@ -373,13 +361,13 @@ public function getTempFolderPath() } /** - * Gets the default configuration instance. + * Gets the default configuration instance * * @return Configuration */ public static function getDefaultConfiguration() { - if (null === self::$defaultConfiguration) { + if (self::$defaultConfiguration === null) { self::$defaultConfiguration = new Configuration(); } @@ -387,9 +375,11 @@ public static function getDefaultConfiguration() } /** - * Sets the detault configuration instance. + * Sets the detault configuration instance * * @param Configuration $config An instance of the Configuration Object + * + * @return void */ public static function setDefaultConfiguration(Configuration $config) { @@ -397,25 +387,25 @@ public static function setDefaultConfiguration(Configuration $config) } /** - * Gets the essential information for debugging. + * Gets the essential information for debugging * * @return string The report for debugging */ public static function toDebugReport() { - $report = 'PHP SDK (HubSpot\Client\Crm\Objects) Debug Report:'.PHP_EOL; - $report .= ' OS: '.php_uname().PHP_EOL; - $report .= ' PHP Version: '.PHP_VERSION.PHP_EOL; - $report .= ' OpenAPI Spec Version: v3'.PHP_EOL; - $report .= ' Temp Folder Path: '.self::getDefaultConfiguration()->getTempFolderPath().PHP_EOL; + $report = 'PHP SDK (HubSpot\Client\Crm\Objects) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' OpenAPI Spec Version: v3' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; } /** - * Get API key (with prefix if set). + * Get API key (with prefix if set) * - * @param string $apiKeyIdentifier name of apikey + * @param string $apiKeyIdentifier name of apikey * * @return string API key with the prefix */ @@ -424,14 +414,14 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); - if (null === $apiKey) { + if ($apiKey === null) { return null; } - if (null === $prefix) { + if ($prefix === null) { $keyWithPrefix = $apiKey; } else { - $keyWithPrefix = $prefix.' '.$apiKey; + $keyWithPrefix = $prefix . ' ' . $apiKey; } return $keyWithPrefix; diff --git a/codegen/Crm/Objects/HeaderSelector.php b/codegen/Crm/Objects/HeaderSelector.php index 1a9b7186..07608447 100644 --- a/codegen/Crm/Objects/HeaderSelector.php +++ b/codegen/Crm/Objects/HeaderSelector.php @@ -1,49 +1,49 @@ selectAcceptHeader($accept); - if (null !== $accept) { + if ($accept !== null) { $headers['Accept'] = $accept; } $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); - return $headers; } /** * @param string[] $accept - * * @return array */ public function selectHeadersForMultipart($accept) @@ -70,12 +68,11 @@ 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. + * Return the header 'Accept' based on an array of Accept provided * * @param string[] $accept Array of header * @@ -83,18 +80,17 @@ public function selectHeadersForMultipart($accept) */ private function selectAcceptHeader($accept) { - if (0 === count($accept) || (1 === count($accept) && '' === $accept[0])) { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { return null; - } - if (preg_grep('/application\\/json/i', $accept)) { + } elseif (preg_grep("/application\/json/i", $accept)) { return 'application/json'; + } else { + return implode(',', $accept); } - - return implode(',', $accept); } /** - * Return the content type based on an array of content-type provided. + * Return the content type based on an array of content-type provided * * @param string[] $contentType Array fo content-type * @@ -102,13 +98,13 @@ private function selectAcceptHeader($accept) */ private function selectContentTypeHeader($contentType) { - if (0 === count($contentType) || (1 === count($contentType) && '' === $contentType[0])) { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { return 'application/json'; - } - if (preg_grep('/application\\/json/i', $contentType)) { + } elseif (preg_grep("/application\/json/i", $contentType)) { return 'application/json'; + } else { + return implode(',', $contentType); } - - return implode(',', $contentType); } } + diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php index f726dd71..bac2d0ac 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php @@ -1,162 +1,125 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'inputs' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'inputs' => 'inputs', + 'inputs' => 'inputs' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'inputs' => 'setInputs', + 'inputs' => 'setInputs' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'inputs' => 'getInputs', + 'inputs' => 'getInputs' ]; - /** - * 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'] = isset($data['inputs']) ? $data['inputs'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['inputs']) ? $data['inputs'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['inputs']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets inputs. + * Gets inputs * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[] */ @@ -233,7 +218,7 @@ public function getInputs() } /** - * Sets inputs. + * Sets inputs * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInput[] $inputs inputs * @@ -245,13 +230,12 @@ public function setInputs($inputs) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php index d62f6073..e2cba211 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php @@ -1,162 +1,125 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'inputs' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'inputs' => 'inputs', + 'inputs' => 'inputs' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'inputs' => 'setInputs', + 'inputs' => 'setInputs' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'inputs' => 'getInputs', + 'inputs' => 'getInputs' ]; - /** - * 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'] = isset($data['inputs']) ? $data['inputs'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['inputs']) ? $data['inputs'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['inputs']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets inputs. + * Gets inputs * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] */ @@ -233,7 +218,7 @@ public function getInputs() } /** - * Sets inputs. + * Sets inputs * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs inputs * @@ -245,13 +230,12 @@ public function setInputs($inputs) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInput.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInput.php index 3c36fefc..4a7605ec 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInput.php @@ -1,162 +1,125 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput[]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput[]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'inputs' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'inputs' => 'inputs', + 'inputs' => 'inputs' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'inputs' => 'setInputs', + 'inputs' => 'setInputs' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'inputs' => 'getInputs', + 'inputs' => 'getInputs' ]; - /** - * 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'] = isset($data['inputs']) ? $data['inputs'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['inputs']) ? $data['inputs'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['inputs']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets inputs. + * Gets inputs * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput[] */ @@ -233,7 +218,7 @@ public function getInputs() } /** - * Sets inputs. + * Sets inputs * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput[] $inputs inputs * @@ -245,13 +230,12 @@ public function setInputs($inputs) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php index e22615a7..09f1a949 100644 --- a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php @@ -1,168 +1,130 @@ 'string[]', - 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[]', + 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[]' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'properties' => null, - 'inputs' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'properties' => 'properties', - 'inputs' => 'inputs', + 'inputs' => 'inputs' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'properties' => 'setProperties', - 'inputs' => 'setInputs', + 'inputs' => 'setInputs' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'properties' => 'getProperties', - 'inputs' => 'getInputs', + 'inputs' => 'getInputs' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - $this->container['inputs'] = isset($data['inputs']) ? $data['inputs'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; + $this->container['inputs'] = isset($data['inputs']) ? $data['inputs'] : null; } /** @@ -210,29 +195,29 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } - if (null === $this->container['inputs']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return string[] */ @@ -242,7 +227,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param string[] $properties properties * @@ -256,7 +241,7 @@ public function setProperties($properties) } /** - * Gets inputs. + * Gets inputs * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] */ @@ -266,7 +251,7 @@ public function getInputs() } /** - * Sets inputs. + * Sets inputs * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $inputs inputs * @@ -278,13 +263,12 @@ public function setInputs($inputs) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -294,7 +278,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -306,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -321,10 +307,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php index b70dcaf3..b28c9468 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php @@ -1,96 +1,109 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject[]', 'num_errors' => 'int', - 'errors' => '\HubSpot\Client\Crm\Objects\Model\StandardError[]', + 'errors' => '\HubSpot\Client\Crm\Objects\Model\Error[]', 'status' => 'string', 'requested_at' => '\DateTime', 'started_at' => '\DateTime', - 'completed_at' => '\DateTime', + 'completed_at' => '\DateTime' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'results' => null, 'num_errors' => null, 'errors' => null, 'status' => null, 'requested_at' => 'date-time', 'started_at' => 'date-time', - 'completed_at' => 'date-time', + 'completed_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. + * and the value is the original name * * @var string[] */ @@ -101,11 +114,11 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess 'status' => 'status', 'requested_at' => 'requestedAt', 'started_at' => 'startedAt', - 'completed_at' => 'completedAt', + 'completed_at' => 'completedAt' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ @@ -116,11 +129,11 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess 'status' => 'setStatus', 'requested_at' => 'setRequestedAt', 'started_at' => 'setStartedAt', - 'completed_at' => 'setCompletedAt', + 'completed_at' => 'setCompletedAt' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ @@ -131,73 +144,12 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess 'status' => 'getStatus', 'requested_at' => 'getRequestedAt', 'started_at' => 'getStartedAt', - 'completed_at' => 'getCompletedAt', + 'completed_at' => 'getCompletedAt' ]; - /** - * 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'] = isset($data['results']) ? $data['results'] : null; - $this->container['num_errors'] = isset($data['num_errors']) ? $data['num_errors'] : null; - $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['requested_at'] = isset($data['requested_at']) ? $data['requested_at'] : null; - $this->container['started_at'] = isset($data['started_at']) ? $data['started_at'] : null; - $this->container['completed_at'] = isset($data['completed_at']) ? $data['completed_at'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -207,7 +159,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -217,7 +169,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -233,11 +185,18 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } + const STATUS_PENDING = 'PENDING'; + const STATUS_PROCESSING = 'PROCESSING'; + const STATUS_CANCELED = 'CANCELED'; + const STATUS_COMPLETE = 'COMPLETE'; + + + /** - * Gets allowable values of the enum. + * Gets allowable values of the enum * * @return string[] */ @@ -250,6 +209,31 @@ public function getStatusAllowableValues() 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['results'] = isset($data['results']) ? $data['results'] : null; + $this->container['num_errors'] = isset($data['num_errors']) ? $data['num_errors'] : null; + $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['requested_at'] = isset($data['requested_at']) ? $data['requested_at'] : null; + $this->container['started_at'] = isset($data['started_at']) ? $data['started_at'] : null; + $this->container['completed_at'] = isset($data['completed_at']) ? $data['completed_at'] : null; + } /** * Show all the invalid properties with reasons. @@ -260,13 +244,13 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['results']) { + if ($this->container['results'] === null) { $invalidProperties[] = "'results' can't be null"; } - if (null === $this->container['errors']) { + if ($this->container['errors'] === null) { $invalidProperties[] = "'errors' can't be null"; } - if (null === $this->container['status']) { + if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } $allowedValues = $this->getStatusAllowableValues(); @@ -277,29 +261,29 @@ public function listInvalidProperties() ); } - if (null === $this->container['started_at']) { + if ($this->container['started_at'] === null) { $invalidProperties[] = "'started_at' can't be null"; } - if (null === $this->container['completed_at']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets results. + * Gets results * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] */ @@ -309,7 +293,7 @@ public function getResults() } /** - * Sets results. + * Sets results * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results * @@ -323,9 +307,9 @@ public function setResults($results) } /** - * Gets num_errors. + * Gets num_errors * - * @return int + * @return int|null */ public function getNumErrors() { @@ -333,9 +317,9 @@ public function getNumErrors() } /** - * Sets num_errors. + * Sets num_errors * - * @param int $num_errors num_errors + * @param int|null $num_errors num_errors * * @return $this */ @@ -347,9 +331,9 @@ public function setNumErrors($num_errors) } /** - * Gets errors. + * Gets errors * - * @return \HubSpot\Client\Crm\Objects\Model\StandardError[] + * @return \HubSpot\Client\Crm\Objects\Model\Error[] */ public function getErrors() { @@ -357,9 +341,9 @@ public function getErrors() } /** - * Sets errors. + * Sets errors * - * @param \HubSpot\Client\Crm\Objects\Model\StandardError[] $errors errors + * @param \HubSpot\Client\Crm\Objects\Model\Error[] $errors errors * * @return $this */ @@ -371,7 +355,7 @@ public function setErrors($errors) } /** - * Gets status. + * Gets status * * @return string */ @@ -381,7 +365,7 @@ public function getStatus() } /** - * Sets status. + * Sets status * * @param string $status status * @@ -404,9 +388,9 @@ public function setStatus($status) } /** - * Gets requested_at. + * Gets requested_at * - * @return \DateTime + * @return \DateTime|null */ public function getRequestedAt() { @@ -414,9 +398,9 @@ public function getRequestedAt() } /** - * Sets requested_at. + * Sets requested_at * - * @param \DateTime $requested_at requested_at + * @param \DateTime|null $requested_at requested_at * * @return $this */ @@ -428,7 +412,7 @@ public function setRequestedAt($requested_at) } /** - * Gets started_at. + * Gets started_at * * @return \DateTime */ @@ -438,7 +422,7 @@ public function getStartedAt() } /** - * Sets started_at. + * Sets started_at * * @param \DateTime $started_at started_at * @@ -452,7 +436,7 @@ public function setStartedAt($started_at) } /** - * Gets completed_at. + * Gets completed_at * * @return \DateTime */ @@ -462,7 +446,7 @@ public function getCompletedAt() } /** - * Sets completed_at. + * Sets completed_at * * @param \DateTime $completed_at completed_at * @@ -474,13 +458,12 @@ public function setCompletedAt($completed_at) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -490,7 +473,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -502,8 +485,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -517,10 +502,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/CollectionResponse.php b/codegen/Crm/Objects/Model/CollectionResponse.php index f9dbe486..62134577 100644 --- a/codegen/Crm/Objects/Model/CollectionResponse.php +++ b/codegen/Crm/Objects/Model/CollectionResponse.php @@ -1,168 +1,130 @@ 'object[]', - 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging', + 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'results' => null, - 'paging' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'results' => 'results', - 'paging' => 'paging', + 'paging' => 'paging' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'results' => 'setResults', - 'paging' => 'setPaging', + 'paging' => 'setPaging' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'results' => 'getResults', - 'paging' => 'getPaging', + 'paging' => 'getPaging' ]; - /** - * 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'] = isset($data['results']) ? $data['results'] : null; - $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['results']) ? $data['results'] : null; + $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; } /** @@ -210,26 +195,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['results']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets results. + * Gets results * * @return object[] */ @@ -239,7 +224,7 @@ public function getResults() } /** - * Sets results. + * Sets results * * @param object[] $results results * @@ -253,9 +238,9 @@ public function setResults($results) } /** - * Gets paging. + * Gets paging * - * @return \HubSpot\Client\Crm\Objects\Model\Paging + * @return \HubSpot\Client\Crm\Objects\Model\Paging|null */ public function getPaging() { @@ -263,9 +248,9 @@ public function getPaging() } /** - * Sets paging. + * Sets paging * - * @param \HubSpot\Client\Crm\Objects\Model\Paging $paging paging + * @param \HubSpot\Client\Crm\Objects\Model\Paging|null $paging paging * * @return $this */ @@ -275,13 +260,12 @@ public function setPaging($paging) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -291,7 +275,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -303,8 +287,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -318,10 +304,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObject.php b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObject.php index cd8dc338..c2e5ec95 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObject.php @@ -1,168 +1,130 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject[]', - 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging', + 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'results' => null, - 'paging' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'results' => 'results', - 'paging' => 'paging', + 'paging' => 'paging' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'results' => 'setResults', - 'paging' => 'setPaging', + 'paging' => 'setPaging' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'results' => 'getResults', - 'paging' => 'getPaging', + 'paging' => 'getPaging' ]; - /** - * 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'] = isset($data['results']) ? $data['results'] : null; - $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['results']) ? $data['results'] : null; + $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; } /** @@ -210,26 +195,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['results']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets results. + * Gets results * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] */ @@ -239,7 +224,7 @@ public function getResults() } /** - * Sets results. + * Sets results * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results * @@ -253,9 +238,9 @@ public function setResults($results) } /** - * Gets paging. + * Gets paging * - * @return \HubSpot\Client\Crm\Objects\Model\Paging + * @return \HubSpot\Client\Crm\Objects\Model\Paging|null */ public function getPaging() { @@ -263,9 +248,9 @@ public function getPaging() } /** - * Sets paging. + * Sets paging * - * @param \HubSpot\Client\Crm\Objects\Model\Paging $paging paging + * @param \HubSpot\Client\Crm\Objects\Model\Paging|null $paging paging * * @return $this */ @@ -275,13 +260,12 @@ public function setPaging($paging) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -291,7 +275,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -303,8 +287,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -318,10 +304,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectId.php b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectId.php index b02934f3..0c252cfd 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectId.php @@ -1,168 +1,130 @@ '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[]', - 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging', + 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'results' => null, - 'paging' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'results' => 'results', - 'paging' => 'paging', + 'paging' => 'paging' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'results' => 'setResults', - 'paging' => 'setPaging', + 'paging' => 'setPaging' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'results' => 'getResults', - 'paging' => 'getPaging', + 'paging' => 'getPaging' ]; - /** - * 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'] = isset($data['results']) ? $data['results'] : null; - $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['results']) ? $data['results'] : null; + $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; } /** @@ -210,26 +195,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['results']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets results. + * Gets results * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] */ @@ -239,7 +224,7 @@ public function getResults() } /** - * Sets results. + * Sets results * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectId[] $results results * @@ -253,9 +238,9 @@ public function setResults($results) } /** - * Gets paging. + * Gets paging * - * @return \HubSpot\Client\Crm\Objects\Model\Paging + * @return \HubSpot\Client\Crm\Objects\Model\Paging|null */ public function getPaging() { @@ -263,9 +248,9 @@ public function getPaging() } /** - * Sets paging. + * Sets paging * - * @param \HubSpot\Client\Crm\Objects\Model\Paging $paging paging + * @param \HubSpot\Client\Crm\Objects\Model\Paging|null $paging paging * * @return $this */ @@ -275,13 +260,12 @@ public function setPaging($paging) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -291,7 +275,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -303,8 +287,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -318,10 +304,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php index 2e916e02..9c7cda08 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObject.php @@ -1,174 +1,135 @@ 'int', 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject[]', - 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging', + 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'total' => null, 'results' => null, - 'paging' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'total' => 'total', 'results' => 'results', - 'paging' => 'paging', + 'paging' => 'paging' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'total' => 'setTotal', 'results' => 'setResults', - 'paging' => 'setPaging', + 'paging' => 'setPaging' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'total' => 'getTotal', 'results' => 'getResults', - 'paging' => 'getPaging', + 'paging' => 'getPaging' ]; - /** - * 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'] = isset($data['total']) ? $data['total'] : null; - $this->container['results'] = isset($data['results']) ? $data['results'] : null; - $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -178,7 +139,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -188,7 +149,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -204,7 +165,31 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['total']) ? $data['total'] : null; + $this->container['results'] = isset($data['results']) ? $data['results'] : null; + $this->container['paging'] = isset($data['paging']) ? $data['paging'] : null; } /** @@ -216,29 +201,29 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['total']) { + if ($this->container['total'] === null) { $invalidProperties[] = "'total' can't be null"; } - if (null === $this->container['results']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets total. + * Gets total * * @return int */ @@ -248,7 +233,7 @@ public function getTotal() } /** - * Sets total. + * Sets total * * @param int $total The number of available results * @@ -262,7 +247,7 @@ public function setTotal($total) } /** - * Gets results. + * Gets results * * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] */ @@ -272,7 +257,7 @@ public function getResults() } /** - * Sets results. + * Sets results * * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results * @@ -286,9 +271,9 @@ public function setResults($results) } /** - * Gets paging. + * Gets paging * - * @return \HubSpot\Client\Crm\Objects\Model\Paging + * @return \HubSpot\Client\Crm\Objects\Model\Paging|null */ public function getPaging() { @@ -296,9 +281,9 @@ public function getPaging() } /** - * Sets paging. + * Sets paging * - * @param \HubSpot\Client\Crm\Objects\Model\Paging $paging paging + * @param \HubSpot\Client\Crm\Objects\Model\Paging|null $paging paging * * @return $this */ @@ -308,13 +293,12 @@ public function setPaging($paging) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -324,7 +308,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -336,8 +320,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -351,10 +337,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/CompanyInput.php b/codegen/Crm/Objects/Model/CompanyInput.php index b38b2183..8ce7da64 100644 --- a/codegen/Crm/Objects/Model/CompanyInput.php +++ b/codegen/Crm/Objects/Model/CompanyInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/ContactInput.php b/codegen/Crm/Objects/Model/ContactInput.php index 5acfa338..dcb30e8c 100644 --- a/codegen/Crm/Objects/Model/ContactInput.php +++ b/codegen/Crm/Objects/Model/ContactInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/DealInput.php b/codegen/Crm/Objects/Model/DealInput.php index e08d15a1..31eb8baf 100644 --- a/codegen/Crm/Objects/Model/DealInput.php +++ b/codegen/Crm/Objects/Model/DealInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/Error.php b/codegen/Crm/Objects/Model/Error.php index 685cae8e..80f2ff8a 100644 --- a/codegen/Crm/Objects/Model/Error.php +++ b/codegen/Crm/Objects/Model/Error.php @@ -1,330 +1,406 @@ 'string', + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ 'message' => 'string', - 'request_id' => 'string', + 'correlation_id' => 'string', + 'category' => 'string', + 'errors' => '\HubSpot\Client\Crm\Objects\Model\ErrorDetail[]', + 'context' => 'map[string,string[]]', + 'links' => 'map[string,string]' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'status' => null, + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'message' => null, - 'request_id' => null, + 'correlation_id' => null, + '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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'status' => 'status', 'message' => 'message', - 'request_id' => 'requestId', + 'correlation_id' => 'correlationId', + 'category' => 'category', + 'errors' => 'errors', + 'context' => 'context', + 'links' => 'links' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'status' => 'setStatus', 'message' => 'setMessage', - 'request_id' => 'setRequestId', + 'correlation_id' => 'setCorrelationId', + 'category' => 'setCategory', + 'errors' => 'setErrors', + 'context' => 'setContext', + 'links' => 'setLinks' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'status' => 'getStatus', 'message' => 'getMessage', - 'request_id' => 'getRequestId', + 'correlation_id' => 'getCorrelationId', + 'category' => 'getCategory', + 'errors' => 'getErrors', + 'context' => 'getContext', + 'links' => 'getLinks' ]; /** - * Associative array for storing property values. + * Array of attributes where the key is the local name, + * and the value is the original name * - * @var mixed[] + * @return array */ - protected $container = []; + public static function attributeMap() + { + return self::$attributeMap; + } /** - * Constructor. + * Array of attributes to setter functions (for deserialization of responses) * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return array */ - public function __construct(array $data = null) + public static function setters() { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['request_id'] = isset($data['request_id']) ? $data['request_id'] : null; + return self::$setters; } /** - * Gets the string presentation of the object. + * Array of attributes to getter functions (for serialization of requests) * - * @return string + * @return array */ - public function __toString() + public static function getters() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + return self::$getters; + } - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; } + + + + /** - * Array of property to type mappings. Used for (de)serialization. + * Associative array for storing property values * - * @return array + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public static function swaggerTypes() + public function __construct(array $data = null) { - return self::$swaggerTypes; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; + $this->container['correlation_id'] = isset($data['correlation_id']) ? $data['correlation_id'] : null; + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; + $this->container['context'] = isset($data['context']) ? $data['context'] : null; + $this->container['links'] = isset($data['links']) ? $data['links'] : null; } /** - * Array of property to format mappings. Used for (de)serialization. + * Show all the invalid properties with reasons. * - * @return array + * @return array invalid properties with reasons */ - public static function swaggerFormats() + public function listInvalidProperties() { - return self::$swaggerFormats; + $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 (!preg_match("/[a-zA-Z0-9]{32}/", $this->container['correlation_id'])) { + $invalidProperties[] = "invalid value for 'correlation_id', must be conform to the pattern /[a-zA-Z0-9]{32}/."; + } + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + return $invalidProperties; } /** - * Array of attributes where the key is the local name, - * and the value is the original name. + * Validate all the properties in the model + * return true if all passed * - * @return array + * @return bool True if all properties are valid */ - public static function attributeMap() + public function valid() { - return self::$attributeMap; + return count($this->listInvalidProperties()) === 0; } + /** - * Array of attributes to setter functions (for deserialization of responses). + * Gets message * - * @return array + * @return string */ - public static function setters() + public function getMessage() { - return self::$setters; + return $this->container['message']; } /** - * Array of attributes to getter functions (for serialization of requests). + * Sets message * - * @return array + * @param string $message A human readable message describing the error along with remediation steps where appropriate + * + * @return $this */ - public static function getters() + public function setMessage($message) { - return self::$getters; + $this->container['message'] = $message; + + return $this; } /** - * The original name of the model. + * Gets correlation_id * * @return string */ - public function getModelName() + public function getCorrelationId() { - return self::$swaggerModelName; + return $this->container['correlation_id']; } /** - * Show all the invalid properties with reasons. + * Sets correlation_id * - * @return array invalid properties with reasons + * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * + * @return $this */ - public function listInvalidProperties() + public function setCorrelationId($correlation_id) { - $invalidProperties = []; - if (null === $this->container['status']) { - $invalidProperties[] = "'status' can't be null"; - } - if (null === $this->container['message']) { - $invalidProperties[] = "'message' can't be null"; - } - if (null === $this->container['request_id']) { - $invalidProperties[] = "'request_id' can't be null"; - } - if (!preg_match('/[a-zA-Z0-9]{32}/', $this->container['request_id'])) { - $invalidProperties[] = "invalid value for 'request_id', must be conform to the pattern /[a-zA-Z0-9]{32}/."; + if ((!preg_match("/[a-zA-Z0-9]{32}/", $correlation_id))) { + throw new \InvalidArgumentException("invalid value for $correlation_id when calling Error., must conform to the pattern /[a-zA-Z0-9]{32}/."); } - return $invalidProperties; + $this->container['correlation_id'] = $correlation_id; + + return $this; } /** - * Validate all the properties in the model - * return true if all passed. + * Gets category * - * @return bool True if all properties are valid + * @return string */ - public function valid() + public function getCategory() { - return 0 === count($this->listInvalidProperties()); + return $this->container['category']; } /** - * Gets status. + * Sets category * - * @return string + * @param string $category The error category + * + * @return $this + */ + public function setCategory($category) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\Model\ErrorDetail[]|null */ - public function getStatus() + public function getErrors() { - return $this->container['status']; + return $this->container['errors']; } /** - * Sets status. + * Sets errors * - * @param string $status The string \"error\" + * @param \HubSpot\Client\Crm\Objects\Model\ErrorDetail[]|null $errors further information about the error * * @return $this */ - public function setStatus($status) + public function setErrors($errors) { - $this->container['status'] = $status; + $this->container['errors'] = $errors; return $this; } /** - * Gets message. + * Gets context * - * @return string + * @return map[string,string[]]|null */ - public function getMessage() + public function getContext() { - return $this->container['message']; + return $this->container['context']; } /** - * Sets message. + * Sets context * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param map[string,string[]]|null $context Context about the error condition * * @return $this */ - public function setMessage($message) + public function setContext($context) { - $this->container['message'] = $message; + $this->container['context'] = $context; return $this; } /** - * Gets request_id. + * Gets links * - * @return string + * @return map[string,string]|null */ - public function getRequestId() + public function getLinks() { - return $this->container['request_id']; + return $this->container['links']; } /** - * Sets request_id. + * Sets links * - * @param string $request_id A unique identifier for the request. Include this value with any error reports or support tickets + * @param map[string,string]|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps * * @return $this */ - public function setRequestId($request_id) + public function setLinks($links) { - if ((!preg_match('/[a-zA-Z0-9]{32}/', $request_id))) { - throw new \InvalidArgumentException("invalid value for {$request_id} when calling Error., must conform to the pattern /[a-zA-Z0-9]{32}/."); - } - - $this->container['request_id'] = $request_id; + $this->container['links'] = $links; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -334,7 +410,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -346,8 +422,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -361,10 +439,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/ErrorCategory.php b/codegen/Crm/Objects/Model/ErrorCategory.php deleted file mode 100644 index b5c8368f..00000000 --- a/codegen/Crm/Objects/Model/ErrorCategory.php +++ /dev/null @@ -1,481 +0,0 @@ - 'string', - 'name' => 'string', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'http_status' => null, - 'name' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'http_status' => 'httpStatus', - 'name' => 'name', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'http_status' => 'setHttpStatus', - 'name' => 'setName', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'http_status' => 'getHttpStatus', - 'name' => 'getName', - ]; - - /** - * 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['http_status'] = isset($data['http_status']) ? $data['http_status'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * 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::$swaggerModelName; - } - - /** - * 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_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, - ]; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (null === $this->container['http_status']) { - $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 for 'http_status', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - if (null === $this->container['name']) { - $invalidProperties[] = "'name' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets http_status. - * - * @return string - */ - public function getHttpStatus() - { - return $this->container['http_status']; - } - - /** - * Sets http_status. - * - * @param string $http_status http_status - * - * @return $this - */ - public function setHttpStatus($http_status) - { - $allowedValues = $this->getHttpStatusAllowableValues(); - if (!in_array($http_status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'http_status', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['http_status'] = $http_status; - - return $this; - } - - /** - * Gets name. - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name. - * - * @param string $name name - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/codegen/Crm/Objects/Model/ErrorDetail.php b/codegen/Crm/Objects/Model/ErrorDetail.php index 0c06106b..8fa6672d 100644 --- a/codegen/Crm/Objects/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Model/ErrorDetail.php @@ -1,87 +1,105 @@ 'object', + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sub_category' => 'string', 'message' => 'string', 'code' => 'string', 'in' => 'string', - 'context' => 'map[string,string[]]', + 'context' => 'map[string,string[]]' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'sub_category' => null, 'message' => null, 'code' => null, 'in' => null, - 'context' => 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. + * and the value is the original name * * @var string[] */ @@ -90,11 +108,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess 'message' => 'message', 'code' => 'code', 'in' => 'in', - 'context' => 'context', + 'context' => 'context' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ @@ -103,11 +121,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess 'message' => 'setMessage', 'code' => 'setCode', 'in' => 'setIn', - 'context' => 'setContext', + 'context' => 'setContext' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ @@ -116,71 +134,12 @@ class ErrorDetail implements ModelInterface, ArrayAccess 'message' => 'getMessage', 'code' => 'getCode', 'in' => 'getIn', - 'context' => 'getContext', + 'context' => 'getContext' ]; - /** - * 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['sub_category'] = isset($data['sub_category']) ? $data['sub_category'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['in'] = isset($data['in']) ? $data['in'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -190,7 +149,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -200,7 +159,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -216,7 +175,33 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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['sub_category'] = isset($data['sub_category']) ? $data['sub_category'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['in'] = isset($data['in']) ? $data['in'] : null; + $this->container['context'] = isset($data['context']) ? $data['context'] : null; } /** @@ -228,31 +213,31 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['message']) { + if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if (null === $this->container['context']) { + if ($this->container['context'] === null) { $invalidProperties[] = "'context' can't be null"; } - return $invalidProperties; } /** * Validate all the properties in the model - * return true if all passed. + * return true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets sub_category. + * Gets sub_category * - * @return object + * @return string|null */ public function getSubCategory() { @@ -260,9 +245,9 @@ public function getSubCategory() } /** - * Sets sub_category. + * Sets sub_category * - * @param object $sub_category sub_category + * @param string|null $sub_category sub_category * * @return $this */ @@ -274,7 +259,7 @@ public function setSubCategory($sub_category) } /** - * Gets message. + * Gets message * * @return string */ @@ -284,9 +269,9 @@ public function getMessage() } /** - * Sets message. + * Sets message * - * @param string $message message + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return $this */ @@ -298,9 +283,9 @@ public function setMessage($message) } /** - * Gets code. + * Gets code * - * @return string + * @return string|null */ public function getCode() { @@ -308,9 +293,9 @@ public function getCode() } /** - * Sets code. + * Sets code * - * @param string $code code + * @param string|null $code code * * @return $this */ @@ -322,9 +307,9 @@ public function setCode($code) } /** - * Gets in. + * Gets in * - * @return string + * @return string|null */ public function getIn() { @@ -332,9 +317,9 @@ public function getIn() } /** - * Sets in. + * Sets in * - * @param string $in in + * @param string|null $in The name of the field or parameter in which the error was found. * * @return $this */ @@ -346,7 +331,7 @@ public function setIn($in) } /** - * Gets context. + * Gets context * * @return map[string,string[]] */ @@ -356,9 +341,9 @@ public function getContext() } /** - * Sets context. + * Sets context * - * @param map[string,string[]] $context context + * @param map[string,string[]] $context Context about the error condition * * @return $this */ @@ -368,13 +353,12 @@ public function setContext($context) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -384,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -396,8 +380,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -411,10 +397,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/Filter.php b/codegen/Crm/Objects/Model/Filter.php index 9d01d798..3a8dcf6c 100644 --- a/codegen/Crm/Objects/Model/Filter.php +++ b/codegen/Crm/Objects/Model/Filter.php @@ -1,188 +1,135 @@ 'string', 'operator' => 'string', - 'value' => 'string', + 'value' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'property_name' => null, 'operator' => null, - 'value' => null, + 'value' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'property_name' => 'propertyName', 'operator' => 'operator', - 'value' => 'value', + 'value' => 'value' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'property_name' => 'setPropertyName', 'operator' => 'setOperator', - 'value' => 'setValue', + 'value' => 'setValue' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'property_name' => 'getPropertyName', 'operator' => 'getOperator', - 'value' => 'getValue', + 'value' => 'getValue' ]; - /** - * 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['property_name'] = isset($data['property_name']) ? $data['property_name'] : null; - $this->container['operator'] = isset($data['operator']) ? $data['operator'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -192,7 +139,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -202,7 +149,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -218,11 +165,27 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } + const OPERATOR_EQ = 'EQ'; + const OPERATOR_NEQ = 'NEQ'; + const OPERATOR_LT = 'LT'; + const OPERATOR_LTE = 'LTE'; + const OPERATOR_GT = 'GT'; + const OPERATOR_GTE = 'GTE'; + const OPERATOR_BETWEEN = 'BETWEEN'; + const OPERATOR_IN = 'IN'; + const OPERATOR_NOT_IN = 'NOT_IN'; + const OPERATOR_HAS_PROPERTY = 'HAS_PROPERTY'; + const OPERATOR_NOT_HAS_PROPERTY = 'NOT_HAS_PROPERTY'; + const OPERATOR_ROLLING_DATE_RANGE = 'ROLLING_DATE_RANGE'; + const OPERATOR_TIME_UNIT_TO_DATE = 'TIME_UNIT_TO_DATE'; + + + /** - * Gets allowable values of the enum. + * Gets allowable values of the enum * * @return string[] */ @@ -244,6 +207,27 @@ public function getOperatorAllowableValues() self::OPERATOR_TIME_UNIT_TO_DATE, ]; } + + + /** + * 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['property_name'] = isset($data['property_name']) ? $data['property_name'] : null; + $this->container['operator'] = isset($data['operator']) ? $data['operator'] : null; + $this->container['value'] = isset($data['value']) ? $data['value'] : null; + } /** * Show all the invalid properties with reasons. @@ -254,10 +238,10 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['property_name']) { + if ($this->container['property_name'] === null) { $invalidProperties[] = "'property_name' can't be null"; } - if (null === $this->container['operator']) { + if ($this->container['operator'] === null) { $invalidProperties[] = "'operator' can't be null"; } $allowedValues = $this->getOperatorAllowableValues(); @@ -273,17 +257,18 @@ public function listInvalidProperties() /** * Validate all the properties in the model - * return true if all passed. + * return true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets property_name. + * Gets property_name * * @return string */ @@ -293,7 +278,7 @@ public function getPropertyName() } /** - * Sets property_name. + * Sets property_name * * @param string $property_name property_name * @@ -307,7 +292,7 @@ public function setPropertyName($property_name) } /** - * Gets operator. + * Gets operator * * @return string */ @@ -317,7 +302,7 @@ public function getOperator() } /** - * Sets operator. + * Sets operator * * @param string $operator operator * @@ -340,9 +325,9 @@ public function setOperator($operator) } /** - * Gets value. + * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -350,9 +335,9 @@ public function getValue() } /** - * Sets value. + * Sets value * - * @param string $value value + * @param string|null $value value * * @return $this */ @@ -362,13 +347,12 @@ public function setValue($value) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -378,7 +362,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -390,8 +374,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -405,10 +391,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/ModelInterface.php b/codegen/Crm/Objects/Model/ModelInterface.php index fbc6438a..dbeac75a 100644 --- a/codegen/Crm/Objects/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Model/ModelInterface.php @@ -1,30 +1,29 @@ 'string', - 'link' => 'string', + 'link' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'after' => null, - 'link' => 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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'after' => 'after', - 'link' => 'link', + 'link' => 'link' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'after' => 'setAfter', - 'link' => 'setLink', + 'link' => 'setLink' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'after' => 'getAfter', - 'link' => 'getLink', + 'link' => 'getLink' ]; - /** - * 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'] = isset($data['after']) ? $data['after'] : null; - $this->container['link'] = isset($data['link']) ? $data['link'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['after']) ? $data['after'] : null; + $this->container['link'] = isset($data['link']) ? $data['link'] : null; } /** @@ -210,26 +195,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['after']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets after. + * Gets after * * @return string */ @@ -239,7 +224,7 @@ public function getAfter() } /** - * Sets after. + * Sets after * * @param string $after after * @@ -253,9 +238,9 @@ public function setAfter($after) } /** - * Gets link. + * Gets link * - * @return string + * @return string|null */ public function getLink() { @@ -263,9 +248,9 @@ public function getLink() } /** - * Sets link. + * Sets link * - * @param string $link link + * @param string|null $link link * * @return $this */ @@ -275,13 +260,12 @@ public function setLink($link) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -291,7 +275,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -303,8 +287,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -318,10 +304,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/Paging.php b/codegen/Crm/Objects/Model/Paging.php index d04270a3..339e38c4 100644 --- a/codegen/Crm/Objects/Model/Paging.php +++ b/codegen/Crm/Objects/Model/Paging.php @@ -1,162 +1,125 @@ '\HubSpot\Client\Crm\Objects\Model\NextPage' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'next' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'next' => '\HubSpot\Client\Crm\Objects\Model\NextPage', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'next' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'next' => 'next', + 'next' => 'next' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'next' => 'setNext', + 'next' => 'setNext' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'next' => 'getNext', + 'next' => 'getNext' ]; - /** - * 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'] = isset($data['next']) ? $data['next'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['next']) ? $data['next'] : null; } /** @@ -202,24 +187,27 @@ public function getModelName() */ public function listInvalidProperties() { - return []; + $invalidProperties = []; + + return $invalidProperties; } /** * Validate all the properties in the model - * return true if all passed. + * return true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets next. + * Gets next * - * @return \HubSpot\Client\Crm\Objects\Model\NextPage + * @return \HubSpot\Client\Crm\Objects\Model\NextPage|null */ public function getNext() { @@ -227,9 +215,9 @@ public function getNext() } /** - * Sets next. + * Sets next * - * @param \HubSpot\Client\Crm\Objects\Model\NextPage $next next + * @param \HubSpot\Client\Crm\Objects\Model\NextPage|null $next next * * @return $this */ @@ -239,13 +227,12 @@ public function setNext($next) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -255,7 +242,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -267,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -282,10 +271,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/ProductInput.php b/codegen/Crm/Objects/Model/ProductInput.php index 99735c71..671169cb 100644 --- a/codegen/Crm/Objects/Model/ProductInput.php +++ b/codegen/Crm/Objects/Model/ProductInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php index b8a15f9c..0f41a1c0 100644 --- a/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php @@ -1,89 +1,107 @@ '\HubSpot\Client\Crm\Objects\Model\Filter[]', 'sorts' => '\HubSpot\Client\Crm\Objects\Model\SortField[]', 'query' => 'string', 'properties' => 'string[]', 'limit' => 'int', - 'after' => 'int', + 'after' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'filters' => null, 'sorts' => null, 'query' => null, 'properties' => null, 'limit' => null, - 'after' => null, + 'after' => 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. + * and the value is the original name * * @var string[] */ @@ -93,11 +111,11 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess 'query' => 'query', 'properties' => 'properties', 'limit' => 'limit', - 'after' => 'after', + 'after' => 'after' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ @@ -107,11 +125,11 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess 'query' => 'setQuery', 'properties' => 'setProperties', 'limit' => 'setLimit', - 'after' => 'setAfter', + 'after' => 'setAfter' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ @@ -121,72 +139,12 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess 'query' => 'getQuery', 'properties' => 'getProperties', 'limit' => 'getLimit', - 'after' => 'getAfter', + 'after' => 'getAfter' ]; - /** - * 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'] = isset($data['filters']) ? $data['filters'] : null; - $this->container['sorts'] = isset($data['sorts']) ? $data['sorts'] : null; - $this->container['query'] = isset($data['query']) ? $data['query'] : null; - $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; - $this->container['limit'] = isset($data['limit']) ? $data['limit'] : null; - $this->container['after'] = isset($data['after']) ? $data['after'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -196,7 +154,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -206,7 +164,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -222,7 +180,34 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['filters']) ? $data['filters'] : null; + $this->container['sorts'] = isset($data['sorts']) ? $data['sorts'] : null; + $this->container['query'] = isset($data['query']) ? $data['query'] : null; + $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; + $this->container['limit'] = isset($data['limit']) ? $data['limit'] : null; + $this->container['after'] = isset($data['after']) ? $data['after'] : null; } /** @@ -234,38 +219,38 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['filters']) { + if ($this->container['filters'] === null) { $invalidProperties[] = "'filters' can't be null"; } - if (null === $this->container['sorts']) { + if ($this->container['sorts'] === null) { $invalidProperties[] = "'sorts' can't be null"; } - if (null === $this->container['properties']) { + if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } - if (null === $this->container['limit']) { + if ($this->container['limit'] === null) { $invalidProperties[] = "'limit' can't be null"; } - if (null === $this->container['after']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets filters. + * Gets filters * * @return \HubSpot\Client\Crm\Objects\Model\Filter[] */ @@ -275,7 +260,7 @@ public function getFilters() } /** - * Sets filters. + * Sets filters * * @param \HubSpot\Client\Crm\Objects\Model\Filter[] $filters filters * @@ -289,7 +274,7 @@ public function setFilters($filters) } /** - * Gets sorts. + * Gets sorts * * @return \HubSpot\Client\Crm\Objects\Model\SortField[] */ @@ -299,7 +284,7 @@ public function getSorts() } /** - * Sets sorts. + * Sets sorts * * @param \HubSpot\Client\Crm\Objects\Model\SortField[] $sorts sorts * @@ -313,9 +298,9 @@ public function setSorts($sorts) } /** - * Gets query. + * Gets query * - * @return string + * @return string|null */ public function getQuery() { @@ -323,9 +308,9 @@ public function getQuery() } /** - * Sets query. + * Sets query * - * @param string $query query + * @param string|null $query query * * @return $this */ @@ -337,7 +322,7 @@ public function setQuery($query) } /** - * Gets properties. + * Gets properties * * @return string[] */ @@ -347,7 +332,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param string[] $properties properties * @@ -361,7 +346,7 @@ public function setProperties($properties) } /** - * Gets limit. + * Gets limit * * @return int */ @@ -371,7 +356,7 @@ public function getLimit() } /** - * Sets limit. + * Sets limit * * @param int $limit limit * @@ -385,7 +370,7 @@ public function setLimit($limit) } /** - * Gets after. + * Gets after * * @return int */ @@ -395,7 +380,7 @@ public function getAfter() } /** - * Sets after. + * Sets after * * @param int $after after * @@ -407,13 +392,12 @@ public function setAfter($after) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -423,7 +407,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -435,8 +419,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -450,10 +436,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObject.php b/codegen/Crm/Objects/Model/SimplePublicObject.php index 5354d786..ba61a8e3 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicObject.php @@ -1,91 +1,109 @@ 'string', 'properties' => 'map[string,string]', - 'created_at' => 'int', - 'updated_at' => 'int', + 'created_at' => 'string', + 'updated_at' => 'string', 'associations' => 'map[string,\HubSpot\Client\Crm\Objects\Model\CollectionResponse]', 'archived' => 'bool', - 'archived_at' => 'int', + 'archived_at' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'id' => null, 'properties' => null, 'created_at' => null, 'updated_at' => null, 'associations' => null, 'archived' => null, - 'archived_at' => null, + 'archived_at' => 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. + * and the value is the original name * * @var string[] */ @@ -96,11 +114,11 @@ class SimplePublicObject implements ModelInterface, ArrayAccess 'updated_at' => 'updatedAt', 'associations' => 'associations', 'archived' => 'archived', - 'archived_at' => 'archivedAt', + 'archived_at' => 'archivedAt' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ @@ -111,11 +129,11 @@ class SimplePublicObject implements ModelInterface, ArrayAccess 'updated_at' => 'setUpdatedAt', 'associations' => 'setAssociations', 'archived' => 'setArchived', - 'archived_at' => 'setArchivedAt', + 'archived_at' => 'setArchivedAt' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ @@ -126,73 +144,12 @@ class SimplePublicObject implements ModelInterface, ArrayAccess 'updated_at' => 'getUpdatedAt', 'associations' => 'getAssociations', 'archived' => 'getArchived', - 'archived_at' => 'getArchivedAt', + 'archived_at' => 'getArchivedAt' ]; - /** - * 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'] = isset($data['id']) ? $data['id'] : null; - $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; - $this->container['created_at'] = isset($data['created_at']) ? $data['created_at'] : null; - $this->container['updated_at'] = isset($data['updated_at']) ? $data['updated_at'] : null; - $this->container['associations'] = isset($data['associations']) ? $data['associations'] : null; - $this->container['archived'] = isset($data['archived']) ? $data['archived'] : null; - $this->container['archived_at'] = isset($data['archived_at']) ? $data['archived_at'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -202,7 +159,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -212,7 +169,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -228,7 +185,35 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['id']) ? $data['id'] : null; + $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; + $this->container['created_at'] = isset($data['created_at']) ? $data['created_at'] : null; + $this->container['updated_at'] = isset($data['updated_at']) ? $data['updated_at'] : null; + $this->container['associations'] = isset($data['associations']) ? $data['associations'] : null; + $this->container['archived'] = isset($data['archived']) ? $data['archived'] : null; + $this->container['archived_at'] = isset($data['archived_at']) ? $data['archived_at'] : null; } /** @@ -240,35 +225,41 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['id']) { + if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - if (null === $this->container['properties']) { + if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } - if (null === $this->container['associations']) { + 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"; + } + if ($this->container['associations'] === null) { $invalidProperties[] = "'associations' can't be null"; } - if (null === $this->container['archived']) { + if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } - return $invalidProperties; } /** * Validate all the properties in the model - * return true if all passed. + * return true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets id. + * Gets id * * @return string */ @@ -278,7 +269,7 @@ public function getId() } /** - * Sets id. + * Sets id * * @param string $id id * @@ -292,7 +283,7 @@ public function setId($id) } /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -302,7 +293,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -316,9 +307,9 @@ public function setProperties($properties) } /** - * Gets created_at. + * Gets created_at * - * @return int + * @return string */ public function getCreatedAt() { @@ -326,9 +317,9 @@ public function getCreatedAt() } /** - * Sets created_at. + * Sets created_at * - * @param int $created_at created_at + * @param string $created_at created_at * * @return $this */ @@ -340,9 +331,9 @@ public function setCreatedAt($created_at) } /** - * Gets updated_at. + * Gets updated_at * - * @return int + * @return string */ public function getUpdatedAt() { @@ -350,9 +341,9 @@ public function getUpdatedAt() } /** - * Sets updated_at. + * Sets updated_at * - * @param int $updated_at updated_at + * @param string $updated_at updated_at * * @return $this */ @@ -364,7 +355,7 @@ public function setUpdatedAt($updated_at) } /** - * Gets associations. + * Gets associations * * @return map[string,\HubSpot\Client\Crm\Objects\Model\CollectionResponse] */ @@ -374,7 +365,7 @@ public function getAssociations() } /** - * Sets associations. + * Sets associations * * @param map[string,\HubSpot\Client\Crm\Objects\Model\CollectionResponse] $associations associations * @@ -388,7 +379,7 @@ public function setAssociations($associations) } /** - * Gets archived. + * Gets archived * * @return bool */ @@ -398,7 +389,7 @@ public function getArchived() } /** - * Sets archived. + * Sets archived * * @param bool $archived archived * @@ -412,9 +403,9 @@ public function setArchived($archived) } /** - * Gets archived_at. + * Gets archived_at * - * @return int + * @return string|null */ public function getArchivedAt() { @@ -422,9 +413,9 @@ public function getArchivedAt() } /** - * Sets archived_at. + * Sets archived_at * - * @param int $archived_at archived_at + * @param string|null $archived_at archived_at * * @return $this */ @@ -434,13 +425,12 @@ public function setArchivedAt($archived_at) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -450,7 +440,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -462,8 +452,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -477,10 +469,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php index d25fc7ac..ab5e414c 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php @@ -1,168 +1,130 @@ 'string', - 'properties' => 'map[string,string]', + 'properties' => 'map[string,string]' ]; /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ 'id' => null, - 'properties' => null, + '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. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'id' => 'id', - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'id' => 'setId', - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'id' => 'getId', - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['id']) ? $data['id'] : null; - $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -172,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -182,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -198,7 +160,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['id']) ? $data['id'] : null; + $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -210,29 +195,29 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['id']) { + if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets id. + * Gets id * * @return string */ @@ -242,7 +227,7 @@ public function getId() } /** - * Sets id. + * Sets id * * @param string $id id * @@ -256,7 +241,7 @@ public function setId($id) } /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -266,7 +251,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -278,13 +263,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -294,7 +278,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -306,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -321,10 +307,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Model/SimplePublicObjectId.php index 8c6d0a93..d8925dde 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectId.php @@ -1,162 +1,125 @@ 'string' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'id' => 'string', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'id' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'id' => 'id', + 'id' => 'id' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'id' => 'setId', + 'id' => 'setId' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'id' => 'getId', + 'id' => 'getId' ]; - /** - * 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'] = isset($data['id']) ? $data['id'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['id']) ? $data['id'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['id']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets id. + * Gets id * * @return string */ @@ -233,7 +218,7 @@ public function getId() } /** - * Sets id. + * Sets id * * @param string $id id * @@ -245,13 +230,12 @@ public function setId($id) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Model/SimplePublicObjectInput.php index a689c979..ca0299c5 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/SortField.php b/codegen/Crm/Objects/Model/SortField.php index b22dc5fc..df80321b 100644 --- a/codegen/Crm/Objects/Model/SortField.php +++ b/codegen/Crm/Objects/Model/SortField.php @@ -1,171 +1,130 @@ 'string', + 'direction' => 'string' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'property_name' => null, + 'direction' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'property_name' => 'string', - 'direction' => 'string', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'property_name' => null, - 'direction' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'property_name' => 'propertyName', - 'direction' => 'direction', + 'direction' => 'direction' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'property_name' => 'setPropertyName', - 'direction' => 'setDirection', + 'direction' => 'setDirection' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'property_name' => 'getPropertyName', - 'direction' => 'getDirection', + 'direction' => 'getDirection' ]; - /** - * 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['property_name'] = isset($data['property_name']) ? $data['property_name'] : null; - $this->container['direction'] = isset($data['direction']) ? $data['direction'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -175,7 +134,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -185,7 +144,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -201,11 +160,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } + const DIRECTION_ASCENDING = 'ASCENDING'; + const DIRECTION_DESCENDING = 'DESCENDING'; + + + /** - * Gets allowable values of the enum. + * Gets allowable values of the enum * * @return string[] */ @@ -216,6 +180,26 @@ public function getDirectionAllowableValues() self::DIRECTION_DESCENDING, ]; } + + + /** + * 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['property_name'] = isset($data['property_name']) ? $data['property_name'] : null; + $this->container['direction'] = isset($data['direction']) ? $data['direction'] : null; + } /** * Show all the invalid properties with reasons. @@ -226,10 +210,10 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['property_name']) { + if ($this->container['property_name'] === null) { $invalidProperties[] = "'property_name' can't be null"; } - if (null === $this->container['direction']) { + if ($this->container['direction'] === null) { $invalidProperties[] = "'direction' can't be null"; } $allowedValues = $this->getDirectionAllowableValues(); @@ -245,17 +229,18 @@ public function listInvalidProperties() /** * Validate all the properties in the model - * return true if all passed. + * return true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets property_name. + * Gets property_name * * @return string */ @@ -265,7 +250,7 @@ public function getPropertyName() } /** - * Sets property_name. + * Sets property_name * * @param string $property_name property_name * @@ -279,7 +264,7 @@ public function setPropertyName($property_name) } /** - * Gets direction. + * Gets direction * * @return string */ @@ -289,7 +274,7 @@ public function getDirection() } /** - * Sets direction. + * Sets direction * * @param string $direction direction * @@ -310,13 +295,12 @@ public function setDirection($direction) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -326,7 +310,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -338,8 +322,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -353,10 +339,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/Model/StandardError.php b/codegen/Crm/Objects/Model/StandardError.php deleted file mode 100644 index 9b68ad4d..00000000 --- a/codegen/Crm/Objects/Model/StandardError.php +++ /dev/null @@ -1,522 +0,0 @@ - 'string', - 'id' => 'string', - 'category' => '\HubSpot\Client\Crm\Objects\Model\ErrorCategory', - 'sub_category' => 'object', - 'message' => 'string', - 'errors' => '\HubSpot\Client\Crm\Objects\Model\ErrorDetail[]', - 'context' => 'map[string,string[]]', - 'links' => 'map[string,string]', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $swaggerFormats = [ - 'status' => null, - 'id' => null, - 'category' => null, - 'sub_category' => null, - 'message' => null, - 'errors' => null, - 'context' => null, - 'links' => null, - ]; - - /** - * 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', - ]; - - /** - * 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'] = isset($data['status']) ? $data['status'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['sub_category'] = isset($data['sub_category']) ? $data['sub_category'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['links'] = isset($data['links']) ? $data['links'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - - /** - * 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::$swaggerModelName; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (null === $this->container['status']) { - $invalidProperties[] = "'status' can't be null"; - } - if (null === $this->container['category']) { - $invalidProperties[] = "'category' can't be null"; - } - if (null === $this->container['message']) { - $invalidProperties[] = "'message' can't be null"; - } - if (null === $this->container['errors']) { - $invalidProperties[] = "'errors' can't be null"; - } - if (null === $this->container['context']) { - $invalidProperties[] = "'context' can't be null"; - } - if (null === $this->container['links']) { - $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 0 === count($this->listInvalidProperties()); - } - - /** - * Gets status. - * - * @return string - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status. - * - * @param string $status status - * - * @return $this - */ - public function setStatus($status) - { - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets id. - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id. - * - * @param string $id id - * - * @return $this - */ - public function setId($id) - { - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets category. - * - * @return \HubSpot\Client\Crm\Objects\Model\ErrorCategory - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category. - * - * @param \HubSpot\Client\Crm\Objects\Model\ErrorCategory $category category - * - * @return $this - */ - public function setCategory($category) - { - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets sub_category. - * - * @return object - */ - public function getSubCategory() - { - return $this->container['sub_category']; - } - - /** - * Sets sub_category. - * - * @param object $sub_category sub_category - * - * @return $this - */ - 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 $this - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Gets errors. - * - * @return \HubSpot\Client\Crm\Objects\Model\ErrorDetail[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors. - * - * @param \HubSpot\Client\Crm\Objects\Model\ErrorDetail[] $errors errors - * - * @return $this - */ - public function setErrors($errors) - { - $this->container['errors'] = $errors; - - return $this; - } - - /** - * Gets context. - * - * @return map[string,string[]] - */ - public function getContext() - { - return $this->container['context']; - } - - /** - * Sets context. - * - * @param map[string,string[]] $context context - * - * @return $this - */ - public function setContext($context) - { - $this->container['context'] = $context; - - return $this; - } - - /** - * Gets links. - * - * @return map[string,string] - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links. - * - * @param map[string,string] $links links - * - * @return $this - */ - public function setLinks($links) - { - $this->container['links'] = $links; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/codegen/Crm/Objects/Model/TicketInput.php b/codegen/Crm/Objects/Model/TicketInput.php index fa472ace..4bcb4063 100644 --- a/codegen/Crm/Objects/Model/TicketInput.php +++ b/codegen/Crm/Objects/Model/TicketInput.php @@ -1,162 +1,125 @@ 'map[string,string]' + ]; /** - * Array of property to type mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerTypes = [ - 'properties' => 'map[string,string]', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * Array of property to format mappings. Used for (de)serialization. + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $swaggerFormats = [ - 'properties' => null, - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @var string[] */ protected static $attributeMap = [ - 'properties' => 'properties', + 'properties' => 'properties' ]; /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ - 'properties' => 'setProperties', + 'properties' => 'setProperties' ]; /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ - 'properties' => 'getProperties', + 'properties' => 'getProperties' ]; - /** - * 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'] = isset($data['properties']) ? $data['properties'] : null; - } - - /** - * Gets the string presentation of the object. - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function swaggerFormats() - { - return self::$swaggerFormats; - } - /** * Array of attributes where the key is the local name, - * and the value is the original name. + * and the value is the original name * * @return array */ @@ -166,7 +129,7 @@ public static function attributeMap() } /** - * Array of attributes to setter functions (for deserialization of responses). + * Array of attributes to setter functions (for deserialization of responses) * * @return array */ @@ -176,7 +139,7 @@ public static function setters() } /** - * Array of attributes to getter functions (for serialization of requests). + * Array of attributes to getter functions (for serialization of requests) * * @return array */ @@ -192,7 +155,29 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + 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'] = isset($data['properties']) ? $data['properties'] : null; } /** @@ -204,26 +189,26 @@ public function listInvalidProperties() { $invalidProperties = []; - if (null === $this->container['properties']) { + 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 true if all passed * * @return bool True if all properties are valid */ public function valid() { - return 0 === count($this->listInvalidProperties()); + return count($this->listInvalidProperties()) === 0; } + /** - * Gets properties. + * Gets properties * * @return map[string,string] */ @@ -233,7 +218,7 @@ public function getProperties() } /** - * Sets properties. + * Sets properties * * @param map[string,string] $properties properties * @@ -245,13 +230,12 @@ public function setProperties($properties) return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset) { @@ -261,7 +245,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed */ @@ -273,8 +257,10 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param int $offset Offset - * @param mixed $value Value to be set + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void */ public function offsetSet($offset, $value) { @@ -288,10 +274,27 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset + * + * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } + + diff --git a/codegen/Crm/Objects/ObjectSerializer.php b/codegen/Crm/Objects/ObjectSerializer.php index 1f345c22..bf81e177 100644 --- a/codegen/Crm/Objects/ObjectSerializer.php +++ b/codegen/Crm/Objects/ObjectSerializer.php @@ -1,105 +1,98 @@ format('Y-m-d') : $data->format(\DateTime::ATOM); - } - if (is_array($data)) { + } elseif ($data instanceof \DateTime) { + return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM); + } elseif (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } - - return $data; - } - if ($data instanceof \stdClass) { - foreach ($data as $property => $value) { - $data->{$property} = self::sanitizeForSerialization($value); - } - return $data; - } - if (is_object($data)) { + } elseif (is_object($data)) { $values = []; - $formats = $data::swaggerFormats(); - foreach ($data::swaggerTypes() as $property => $swaggerType) { - $getter = $data::getters()[$property]; - $value = $data->{$getter}(); - if (null !== $value - && !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) - && method_exists($swaggerType, 'getAllowableEnumValues') - && !in_array($value, $swaggerType::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); - - throw new \InvalidArgumentException("Invalid value for enum '{$swaggerType}', must be one of: '{$imploded}'"); + 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', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + 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]); + } } - if (null !== $value) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } - - return (object) $values; + return (object)$values; + } else { + return (string)$data; } - - return (string) $data; } /** * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif. + * e.g. ../../sun.gif becomes sun.gif * * @param string $filename filename to be sanitized * @@ -107,11 +100,11 @@ public static function sanitizeForSerialization($data, $type = null, $format = n */ public static function sanitizeFilename($filename) { - if (preg_match('/.*[\\/\\\\](.*)$/', $filename, $match)) { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { return $match[1]; + } else { + return $filename; } - - return $filename; } /** @@ -133,7 +126,7 @@ public static function toPathValue($value) * If it's a string, pass through unchanged. It will be url-encoded * later. * - * @param \DateTime|string|string[] $object an object to be serialized to a string + * @param string[]|string|\DateTime $object an object to be serialized to a string * * @return string the serialized object */ @@ -141,15 +134,15 @@ public static function toQueryValue($object) { if (is_array($object)) { return implode(',', $object); + } else { + return self::toString($object); } - - return self::toString($object); } /** * 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. + * If it's a datetime object, format it in ISO8601 * * @param string $value a string which will be part of the header * @@ -163,9 +156,9 @@ public static function toHeaderValue($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. + * If it's a datetime object, format it in ISO8601 * - * @param \SplFileObject|string $value the value of the form parameter + * @param string|\SplFileObject $value the value of the form parameter * * @return string the form string */ @@ -173,17 +166,17 @@ public static function toFormValue($value) { if ($value instanceof \SplFileObject) { return $value->getRealPath(); + } else { + return self::toString($value); } - - 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 datetime object, format it in ISO8601 * - * @param \DateTime|string $value the value of the parameter + * @param string|\DateTime $value the value of the parameter * * @return string the header string */ @@ -191,9 +184,9 @@ public static function toString($value) { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(\DateTime::ATOM); + } else { + return $value; } - - return $value; } /** @@ -201,7 +194,7 @@ public static function toString($value) * * @param array $collection collection to serialize to a string * @param string $collectionFormat the format use for serialization (csv, - * ssv, tsv, pipes, multi) + * ssv, tsv, pipes, multi) * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array * * @return string @@ -216,10 +209,13 @@ public static function serializeCollection(array $collection, $collectionFormat, switch ($collectionFormat) { case 'pipes': return implode('|', $collection); + case 'tsv': return implode("\t", $collection); + case 'ssv': return implode(' ', $collection); + case 'csv': // Deliberate fall through. CSV is default format. default: @@ -228,48 +224,44 @@ public static function serializeCollection(array $collection, $collectionFormat, } /** - * Deserialize a JSON string into an object. + * 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 null|array|object an single or an array of $class instances + * @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 ('map[' === substr($class, 0, 4)) { // for associative array e.g. map[string,int] + } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; - if (false !== strrpos($inner, ',')) { + 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 (0 === strcasecmp(substr($class, -2), '[]')) { + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { $values[] = self::deserialize($value, $subClass, null); } - return $values; - } - if ('object' === $class) { + } elseif ($class === 'object') { settype($data, 'array'); - return $data; - } - if ('\DateTime' === $class) { + } elseif ($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 @@ -278,20 +270,19 @@ public static function deserialize($data, $class, $httpHeaders = null) // this graceful. if (!empty($data)) { return new \DateTime($data); + } else { + return null; } - - return null; } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); - return $data; - } elseif ('\SplFileObject' === $class) { - // @var \Psr\Http\Message\StreamInterface $data + } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name if (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]); + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); } @@ -306,34 +297,33 @@ public static function deserialize($data, $class, $httpHeaders = null) } elseif (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}'"); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } - return $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\Model\\'.$data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; + } 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\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } } - } - $instance = new $class(); - foreach ($instance::swaggerTypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { - continue; - } + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } - $propertyValue = $data->{$instance::attributeMap()[$property]}; - if (isset($propertyValue)) { - $instance->{$propertySetter}(self::deserialize($propertyValue, $type, null)); + $propertyValue = $data->{$instance::attributeMap()[$property]}; + if (isset($propertyValue)) { + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } } + return $instance; } - - return $instance; } }