diff --git a/codegen/Crm/Companies/Api/AssociationsApi.php b/codegen/Crm/Companies/Api/AssociationsApi.php index 8b29b66d..4fe9e197 100644 --- a/codegen/Crm/Companies/Api/AssociationsApi.php +++ b/codegen/Crm/Companies/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two companies + * Delete * - * @param string $company_id company_id (required) + * @param int $company_id company_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($company_id, $to_object_type, $to_object_id, $association_type) + public function archive($company_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($company_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two companies + * Delete * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($company_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($company_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($company_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($company_id, $to_object_type, $to_object_id, /** * Operation archiveAsync * - * Remove an association between two companies + * Delete * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($company_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($company_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two companies + * Delete * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($company_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($company_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($company_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($company_id, $to_object_type, $to_object_id) { // verify the required parameter 'company_id' is set if ($company_id === null || (is_array($company_id) && count($company_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($company_id, $to_object_type, $to_object_id, $ass 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/companies/{companyId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($company_id, $to_object_type, $to_object_id, $ass $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($company_id, $to_object_type, $to_object_id, $ass /** * Operation create * - * Associate a company with another object + * Create * - * @param string $company_id company_id (required) + * @param int $company_id company_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Companies\Model\Error + * @return \HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Companies\Model\Error */ - public function create($company_id, $to_object_type, $to_object_id, $association_type) + public function create($company_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a company with another object + * Create * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($company_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($company_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, ]; } - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($company_id, $to_object_type, $to_object_id, /** * Operation createAsync * - * Associate a company with another object + * Create * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($company_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($company_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a company with another object + * Create * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($company_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($company_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Companies\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($company_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($company_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($company_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'company_id' is set if ($company_id === null || (is_array($company_id) && count($company_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($company_id, $to_object_type, $to_object_id, $asso 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($company_id, $to_object_type, $to_object_id, $asso $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($company_id, $to_object_type, $to_object_id, $asso } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($company_id, $to_object_type, $to_object_id, $asso /** * Operation getAll * - * List associations of a company by type + * List * - * @param string $company_id company_id (required) + * @param int $company_id company_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Companies\Model\Error + * @return \HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Companies\Model\Error */ public function getAll($company_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($company_id, $to_object_type, $after = null, $limit = 500 /** * Operation getAllWithHttpInfo * - * List associations of a company by type + * List * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($company_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($company_id, $to_object_type, $after = null, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($company_id, $to_object_type, $after = null, ]; } - $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($company_id, $to_object_type, $after = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($company_id, $to_object_type, $after = null, /** * Operation getAllAsync * - * List associations of a company by type + * List * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a company by type + * List * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($company_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($company_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $company_id (required) + * @param int $company_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Companies/Model/AssociationSpec.php b/codegen/Crm/Companies/Model/AssociationSpec.php new file mode 100644 index 00000000..68967885 --- /dev/null +++ b/codegen/Crm/Companies/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/AssociationSpecWithLabel.php b/codegen/Crm/Companies/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..12976b9e --- /dev/null +++ b/codegen/Crm/Companies/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Companies/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Companies/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Companies/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index cb20d658..0e0b0137 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Companies/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Companies\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Companies\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Companies\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Companies\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Companies\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Companies\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Companies\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Companies/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Companies/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..02702584 --- /dev/null +++ b/codegen/Crm/Companies/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Companies/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..5b384d61 --- /dev/null +++ b/codegen/Crm/Companies/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Companies\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Api/AssociationsApi.php b/codegen/Crm/Contacts/Api/AssociationsApi.php index a555a375..d6e986a3 100644 --- a/codegen/Crm/Contacts/Api/AssociationsApi.php +++ b/codegen/Crm/Contacts/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two contacts + * Delete * - * @param string $contact_id contact_id (required) + * @param int $contact_id contact_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($contact_id, $to_object_type, $to_object_id, $association_type) + public function archive($contact_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($contact_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two contacts + * Delete * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($contact_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($contact_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($contact_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($contact_id, $to_object_type, $to_object_id, /** * Operation archiveAsync * - * Remove an association between two contacts + * Delete * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($contact_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($contact_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two contacts + * Delete * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($contact_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($contact_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($contact_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($contact_id, $to_object_type, $to_object_id) { // verify the required parameter 'contact_id' is set if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($contact_id, $to_object_type, $to_object_id, $ass 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/contacts/{contactId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($contact_id, $to_object_type, $to_object_id, $ass $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($contact_id, $to_object_type, $to_object_id, $ass /** * Operation create * - * Associate a contact with another object + * Create * - * @param string $contact_id contact_id (required) + * @param int $contact_id contact_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Contacts\Model\Error + * @return \HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Contacts\Model\Error */ - public function create($contact_id, $to_object_type, $to_object_id, $association_type) + public function create($contact_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a contact with another object + * Create * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($contact_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($contact_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, ]; } - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($contact_id, $to_object_type, $to_object_id, /** * Operation createAsync * - * Associate a contact with another object + * Create * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($contact_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($contact_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a contact with another object + * Create * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($contact_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($contact_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Contacts\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($contact_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($contact_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($contact_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'contact_id' is set if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($contact_id, $to_object_type, $to_object_id, $asso 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($contact_id, $to_object_type, $to_object_id, $asso $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($contact_id, $to_object_type, $to_object_id, $asso } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($contact_id, $to_object_type, $to_object_id, $asso /** * Operation getAll * - * List associations of a contact by type + * List * - * @param string $contact_id contact_id (required) + * @param int $contact_id contact_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Contacts\Model\Error + * @return \HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Contacts\Model\Error */ public function getAll($contact_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($contact_id, $to_object_type, $after = null, $limit = 500 /** * Operation getAllWithHttpInfo * - * List associations of a contact by type + * List * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($contact_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($contact_id, $to_object_type, $after = null, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($contact_id, $to_object_type, $after = null, ]; } - $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($contact_id, $to_object_type, $after = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($contact_id, $to_object_type, $after = null, /** * Operation getAllAsync * - * List associations of a contact by type + * List * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a contact by type + * List * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($contact_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($contact_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $contact_id (required) + * @param int $contact_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Contacts/Model/AssociationSpec.php b/codegen/Crm/Contacts/Model/AssociationSpec.php new file mode 100644 index 00000000..fc01011b --- /dev/null +++ b/codegen/Crm/Contacts/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/AssociationSpecWithLabel.php b/codegen/Crm/Contacts/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..d8475d52 --- /dev/null +++ b/codegen/Crm/Contacts/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Contacts/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Contacts/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Contacts/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index d07e922b..b16fb110 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Contacts\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Contacts\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Contacts\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Contacts\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Contacts\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Contacts\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Contacts\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Contacts/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Contacts/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..f8d1a5b7 --- /dev/null +++ b/codegen/Crm/Contacts/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Contacts/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..924e18ad --- /dev/null +++ b/codegen/Crm/Contacts/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Contacts\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Api/AssociationsApi.php b/codegen/Crm/Deals/Api/AssociationsApi.php index c9d30bdf..44a65a35 100644 --- a/codegen/Crm/Deals/Api/AssociationsApi.php +++ b/codegen/Crm/Deals/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two deals + * Delete * - * @param string $deal_id deal_id (required) + * @param int $deal_id deal_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($deal_id, $to_object_type, $to_object_id, $association_type) + public function archive($deal_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($deal_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two deals + * Delete * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($deal_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($deal_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($deal_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($deal_id, $to_object_type, $to_object_id, $a /** * Operation archiveAsync * - * Remove an association between two deals + * Delete * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($deal_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($deal_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two deals + * Delete * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($deal_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($deal_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($deal_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($deal_id, $to_object_type, $to_object_id) { // verify the required parameter 'deal_id' is set if ($deal_id === null || (is_array($deal_id) && count($deal_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($deal_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/deals/{dealId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($deal_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($deal_id, $to_object_type, $to_object_id, $associ /** * Operation create * - * Associate a deal with another object + * Create * - * @param string $deal_id deal_id (required) + * @param int $deal_id deal_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Deals\Model\Error + * @return \HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Deals\Model\Error */ - public function create($deal_id, $to_object_type, $to_object_id, $association_type) + public function create($deal_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a deal with another object + * Create * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($deal_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($deal_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $as } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $as ]; } - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $as } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($deal_id, $to_object_type, $to_object_id, $as /** * Operation createAsync * - * Associate a deal with another object + * Create * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($deal_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($deal_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a deal with another object + * Create * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($deal_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($deal_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Deals\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($deal_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($deal_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($deal_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'deal_id' is set if ($deal_id === null || (is_array($deal_id) && count($deal_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($deal_id, $to_object_type, $to_object_id, $associa 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($deal_id, $to_object_type, $to_object_id, $associa $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($deal_id, $to_object_type, $to_object_id, $associa } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($deal_id, $to_object_type, $to_object_id, $associa /** * Operation getAll * - * List associations of a deal by type + * List * - * @param string $deal_id deal_id (required) + * @param int $deal_id deal_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Deals\Model\Error + * @return \HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Deals\Model\Error */ public function getAll($deal_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($deal_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a deal by type + * List * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($deal_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($deal_id, $to_object_type, $after = null, $li switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($deal_id, $to_object_type, $after = null, $li ]; } - $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($deal_id, $to_object_type, $after = null, $li case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($deal_id, $to_object_type, $after = null, $li /** * Operation getAllAsync * - * List associations of a deal by type + * List * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a deal by type + * List * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($deal_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($deal_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $deal_id (required) + * @param int $deal_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Deals/Model/AssociationSpec.php b/codegen/Crm/Deals/Model/AssociationSpec.php new file mode 100644 index 00000000..524beec4 --- /dev/null +++ b/codegen/Crm/Deals/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/AssociationSpecWithLabel.php b/codegen/Crm/Deals/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..60a3420a --- /dev/null +++ b/codegen/Crm/Deals/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Deals/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Deals/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Deals/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 80f6cdd1..84ecc8bc 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Deals/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Deals\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Deals\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Deals\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Deals\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Deals\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Deals\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Deals\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Deals/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Deals/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..df11333f --- /dev/null +++ b/codegen/Crm/Deals/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Deals/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..cd33b77b --- /dev/null +++ b/codegen/Crm/Deals/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Deals\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Imports/Model/ImportRowCore.php b/codegen/Crm/Imports/Model/ImportRowCore.php index 15d2ca1e..6f0ade44 100644 --- a/codegen/Crm/Imports/Model/ImportRowCore.php +++ b/codegen/Crm/Imports/Model/ImportRowCore.php @@ -58,9 +58,9 @@ class ImportRowCore implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'line_number' => 'int', - 'page_name' => 'string', 'row_data' => 'string[]', - 'file_id' => 'int' + 'file_id' => 'int', + 'page_name' => 'string' ]; /** @@ -72,9 +72,9 @@ class ImportRowCore implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'line_number' => 'int32', - 'page_name' => null, 'row_data' => null, - 'file_id' => 'int32' + 'file_id' => 'int32', + 'page_name' => null ]; /** @@ -105,9 +105,9 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'line_number' => 'lineNumber', - 'page_name' => 'pageName', 'row_data' => 'rowData', - 'file_id' => 'fileId' + 'file_id' => 'fileId', + 'page_name' => 'pageName' ]; /** @@ -117,9 +117,9 @@ public static function openAPIFormats() */ protected static $setters = [ 'line_number' => 'setLineNumber', - 'page_name' => 'setPageName', 'row_data' => 'setRowData', - 'file_id' => 'setFileId' + 'file_id' => 'setFileId', + 'page_name' => 'setPageName' ]; /** @@ -129,9 +129,9 @@ public static function openAPIFormats() */ protected static $getters = [ 'line_number' => 'getLineNumber', - 'page_name' => 'getPageName', 'row_data' => 'getRowData', - 'file_id' => 'getFileId' + 'file_id' => 'getFileId', + 'page_name' => 'getPageName' ]; /** @@ -192,9 +192,9 @@ public function getModelName() public function __construct(array $data = null) { $this->container['line_number'] = $data['line_number'] ?? null; - $this->container['page_name'] = $data['page_name'] ?? null; $this->container['row_data'] = $data['row_data'] ?? null; $this->container['file_id'] = $data['file_id'] ?? null; + $this->container['page_name'] = $data['page_name'] ?? null; } /** @@ -254,30 +254,6 @@ public function setLineNumber($line_number) return $this; } - /** - * Gets page_name - * - * @return string|null - */ - public function getPageName() - { - return $this->container['page_name']; - } - - /** - * Sets page_name - * - * @param string|null $page_name page_name - * - * @return self - */ - public function setPageName($page_name) - { - $this->container['page_name'] = $page_name; - - return $this; - } - /** * Gets row_data * @@ -325,6 +301,30 @@ public function setFileId($file_id) return $this; } + + /** + * Gets page_name + * + * @return string|null + */ + public function getPageName() + { + return $this->container['page_name']; + } + + /** + * Sets page_name + * + * @param string|null $page_name page_name + * + * @return self + */ + public function setPageName($page_name) + { + $this->container['page_name'] = $page_name; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Crm/LineItems/Api/AssociationsApi.php b/codegen/Crm/LineItems/Api/AssociationsApi.php index ae4d21bf..c3421041 100644 --- a/codegen/Crm/LineItems/Api/AssociationsApi.php +++ b/codegen/Crm/LineItems/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two line items + * Delete * - * @param string $line_item_id line_item_id (required) + * @param int $line_item_id line_item_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($line_item_id, $to_object_type, $to_object_id, $association_type) + public function archive($line_item_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($line_item_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two line items + * Delete * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($line_item_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($line_item_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($line_item_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($line_item_id, $to_object_type, $to_object_i /** * Operation archiveAsync * - * Remove an association between two line items + * Delete * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($line_item_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($line_item_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two line items + * Delete * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($line_item_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($line_item_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($line_item_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($line_item_id, $to_object_type, $to_object_id) { // verify the required parameter 'line_item_id' is set if ($line_item_id === null || (is_array($line_item_id) && count($line_item_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($line_item_id, $to_object_type, $to_object_id, $a 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/line_items/{lineItemId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($line_item_id, $to_object_type, $to_object_id, $a $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($line_item_id, $to_object_type, $to_object_id, $a /** * Operation create * - * Associate a line item with another object + * Create * - * @param string $line_item_id line_item_id (required) + * @param int $line_item_id line_item_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\LineItems\Model\Error + * @return \HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\LineItems\Model\Error */ - public function create($line_item_id, $to_object_type, $to_object_id, $association_type) + public function create($line_item_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a line item with another object + * Create * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\LineItems\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\LineItems\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($line_item_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($line_item_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id ]; } - $returnType = '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($line_item_id, $to_object_type, $to_object_id /** * Operation createAsync * - * Associate a line item with another object + * Create * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($line_item_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($line_item_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a line item with another object + * Create * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($line_item_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($line_item_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\LineItems\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($line_item_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($line_item_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($line_item_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'line_item_id' is set if ($line_item_id === null || (is_array($line_item_id) && count($line_item_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($line_item_id, $to_object_type, $to_object_id, $as 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($line_item_id, $to_object_type, $to_object_id, $as $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($line_item_id, $to_object_type, $to_object_id, $as } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($line_item_id, $to_object_type, $to_object_id, $as /** * Operation getAll * - * List associations of a line item by type + * List * - * @param string $line_item_id line_item_id (required) + * @param int $line_item_id line_item_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\LineItems\Model\Error + * @return \HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\LineItems\Model\Error */ public function getAll($line_item_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($line_item_id, $to_object_type, $after = null, $limit = 5 /** * Operation getAllWithHttpInfo * - * List associations of a line item by type + * List * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\LineItems\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\LineItems\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($line_item_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($line_item_id, $to_object_type, $after = null switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($line_item_id, $to_object_type, $after = null ]; } - $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($line_item_id, $to_object_type, $after = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($line_item_id, $to_object_type, $after = null /** * Operation getAllAsync * - * List associations of a line item by type + * List * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a line item by type + * List * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($line_item_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($line_item_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $line_item_id (required) + * @param int $line_item_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/LineItems/Model/AssociationSpec.php b/codegen/Crm/LineItems/Model/AssociationSpec.php new file mode 100644 index 00000000..b3c06c3c --- /dev/null +++ b/codegen/Crm/LineItems/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/LineItems/Model/AssociationSpecWithLabel.php b/codegen/Crm/LineItems/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..763ced0f --- /dev/null +++ b/codegen/Crm/LineItems/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/LineItems/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/LineItems/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/LineItems/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/LineItems/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 2acafc85..ed158c5b 100644 --- a/codegen/Crm/LineItems/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/LineItems/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\LineItems\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\LineItems\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\LineItems\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\LineItems\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\LineItems\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\LineItems\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\LineItems\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/LineItems/Model/LabelsBetweenObjectPair.php b/codegen/Crm/LineItems/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..9684fcca --- /dev/null +++ b/codegen/Crm/LineItems/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/LineItems/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/LineItems/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..1d8d6dc3 --- /dev/null +++ b/codegen/Crm/LineItems/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\LineItems\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\LineItems\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\LineItems\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Calls/Api/AssociationsApi.php b/codegen/Crm/Objects/Calls/Api/AssociationsApi.php index 989140fc..a6f1c23a 100644 --- a/codegen/Crm/Objects/Calls/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Calls/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two calls + * Delete * - * @param string $call_id call_id (required) + * @param int $call_id call_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($call_id, $to_object_type, $to_object_id, $association_type) + public function archive($call_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($call_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two calls + * Delete * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($call_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($call_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($call_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($call_id, $to_object_type, $to_object_id, $a /** * Operation archiveAsync * - * Remove an association between two calls + * Delete * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($call_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($call_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two calls + * Delete * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($call_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($call_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($call_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($call_id, $to_object_type, $to_object_id) { // verify the required parameter 'call_id' is set if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($call_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/calls/{callId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($call_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($call_id, $to_object_type, $to_object_id, $associ /** * Operation create * - * Associate a call with another object + * Create * - * @param string $call_id call_id (required) + * @param int $call_id call_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Calls\Model\Error + * @return \HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Calls\Model\Error */ - public function create($call_id, $to_object_type, $to_object_id, $association_type) + public function create($call_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a call with another object + * Create * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Calls\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Calls\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($call_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($call_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $as } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $as ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $as } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($call_id, $to_object_type, $to_object_id, $as /** * Operation createAsync * - * Associate a call with another object + * Create * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($call_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($call_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a call with another object + * Create * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($call_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($call_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($call_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($call_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($call_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'call_id' is set if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($call_id, $to_object_type, $to_object_id, $associa 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($call_id, $to_object_type, $to_object_id, $associa $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($call_id, $to_object_type, $to_object_id, $associa } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($call_id, $to_object_type, $to_object_id, $associa /** * Operation getAll * - * List associations of a call by type + * List * - * @param string $call_id call_id (required) + * @param int $call_id call_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Calls\Model\Error + * @return \HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Calls\Model\Error */ public function getAll($call_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($call_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a call by type + * List * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Calls\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Calls\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($call_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($call_id, $to_object_type, $after = null, $li switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($call_id, $to_object_type, $after = null, $li ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($call_id, $to_object_type, $after = null, $li case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($call_id, $to_object_type, $after = null, $li /** * Operation getAllAsync * - * List associations of a call by type + * List * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a call by type + * List * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($call_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($call_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $call_id (required) + * @param int $call_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/Calls/Model/AssociationSpec.php b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php new file mode 100644 index 00000000..7dd98888 --- /dev/null +++ b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Calls/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/Calls/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..e881bdbb --- /dev/null +++ b/codegen/Crm/Objects/Calls/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 91% rename from codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/Calls/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index f0c8bd4f..02d70cae 100644 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/Calls/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\Calls\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\Calls\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\Calls\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\Calls\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\Calls\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Calls\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/Calls/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..ead666b6 --- /dev/null +++ b/codegen/Crm/Objects/Calls/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Calls/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/Calls/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..9fc1a6d5 --- /dev/null +++ b/codegen/Crm/Objects/Calls/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\Calls\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Emails/Api/AssociationsApi.php b/codegen/Crm/Objects/Emails/Api/AssociationsApi.php index a987e11e..bf68e58a 100644 --- a/codegen/Crm/Objects/Emails/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Emails/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two emails + * Delete * - * @param string $email_id email_id (required) + * @param int $email_id email_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($email_id, $to_object_type, $to_object_id, $association_type) + public function archive($email_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($email_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two emails + * Delete * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($email_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($email_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($email_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($email_id, $to_object_type, $to_object_id, $ /** * Operation archiveAsync * - * Remove an association between two emails + * Delete * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($email_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($email_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two emails + * Delete * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($email_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($email_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($email_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($email_id, $to_object_type, $to_object_id) { // verify the required parameter 'email_id' is set if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($email_id, $to_object_type, $to_object_id, $assoc 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/emails/{emailId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($email_id, $to_object_type, $to_object_id, $assoc $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($email_id, $to_object_type, $to_object_id, $assoc /** * Operation create * - * Associate a email with another object + * Create * - * @param string $email_id email_id (required) + * @param int $email_id email_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Emails\Model\Error + * @return \HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function create($email_id, $to_object_type, $to_object_id, $association_type) + public function create($email_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a email with another object + * Create * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($email_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($email_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $a } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $a ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $a } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($email_id, $to_object_type, $to_object_id, $a /** * Operation createAsync * - * Associate a email with another object + * Create * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($email_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($email_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a email with another object + * Create * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($email_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($email_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($email_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($email_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($email_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'email_id' is set if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($email_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($email_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($email_id, $to_object_type, $to_object_id, $associ } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($email_id, $to_object_type, $to_object_id, $associ /** * Operation getAll * - * List associations of a email by type + * List * - * @param string $email_id email_id (required) + * @param int $email_id email_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error + * @return \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ public function getAll($email_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($email_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a email by type + * List * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($email_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($email_id, $to_object_type, $after = null, $l switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($email_id, $to_object_type, $after = null, $l ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($email_id, $to_object_type, $after = null, $l case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($email_id, $to_object_type, $after = null, $l /** * Operation getAllAsync * - * List associations of a email by type + * List * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a email by type + * List * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($email_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($email_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $email_id (required) + * @param int $email_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php new file mode 100644 index 00000000..46e4d8a0 --- /dev/null +++ b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Emails/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/Emails/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..58e3eda0 --- /dev/null +++ b/codegen/Crm/Objects/Emails/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 91% rename from codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/Emails/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 7e698b55..8141b4eb 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\Emails\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\Emails\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\Emails\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\Emails\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\Emails\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Emails\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/Emails/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..05e352bb --- /dev/null +++ b/codegen/Crm/Objects/Emails/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Emails/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/Emails/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..04d5364a --- /dev/null +++ b/codegen/Crm/Objects/Emails/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\Emails\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/AssociationsApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/AssociationsApi.php index 862d7573..55d4f243 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two feedback submissions + * Delete * - * @param string $feedback_submission_id feedback_submission_id (required) + * @param int $feedback_submission_id feedback_submission_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function archive($feedback_submission_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two feedback submissions + * Delete * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($feedback_submission_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($feedback_submission_id, $to_object_type, $t /** * Operation archiveAsync * - * Remove an association between two feedback submissions + * Delete * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($feedback_submission_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two feedback submissions + * Delete * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($feedback_submission_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($feedback_submission_id, $to_object_type, $to_object_id) { // verify the required parameter 'feedback_submission_id' is set if ($feedback_submission_id === null || (is_array($feedback_submission_id) && count($feedback_submission_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($feedback_submission_id, $to_object_type, $to_obj 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/feedback_submissions/{feedbackSubmissionId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($feedback_submission_id, $to_object_type, $to_obj $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($feedback_submission_id, $to_object_type, $to_obj /** * Operation create * - * Associate a feedback submission with another object + * Create * - * @param string $feedback_submission_id feedback_submission_id (required) + * @param int $feedback_submission_id feedback_submission_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error + * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error */ - public function create($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function create($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a feedback submission with another object + * Create * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to ]; } - $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($feedback_submission_id, $to_object_type, $to /** * Operation createAsync * - * Associate a feedback submission with another object + * Create * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a feedback submission with another object + * Create * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($feedback_submission_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'feedback_submission_id' is set if ($feedback_submission_id === null || (is_array($feedback_submission_id) && count($feedback_submission_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($feedback_submission_id, $to_object_type, $to_obje 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($feedback_submission_id, $to_object_type, $to_obje $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($feedback_submission_id, $to_object_type, $to_obje } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($feedback_submission_id, $to_object_type, $to_obje /** * Operation getPage * - * List associations of a feedback submission by type + * List * - * @param string $feedback_submission_id feedback_submission_id (required) + * @param int $feedback_submission_id feedback_submission_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error + * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error */ public function getPage($feedback_submission_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getPage($feedback_submission_id, $to_object_type, $after = null, /** * Operation getPageWithHttpInfo * - * List associations of a feedback submission by type + * List * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getPageWithHttpInfo($feedback_submission_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getPageWithHttpInfo($feedback_submission_id, $to_object_type, $a switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getPageWithHttpInfo($feedback_submission_id, $to_object_type, $a ]; } - $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getPageWithHttpInfo($feedback_submission_id, $to_object_type, $a case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getPageWithHttpInfo($feedback_submission_id, $to_object_type, $a /** * Operation getPageAsync * - * List associations of a feedback submission by type + * List * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * List associations of a feedback submission by type + * List * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getPageAsyncWithHttpInfo($feedback_submission_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getPageRequest($feedback_submission_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $feedback_submission_id (required) + * @param int $feedback_submission_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpec.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpec.php new file mode 100644 index 00000000..c635c46f --- /dev/null +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..06d8aec8 --- /dev/null +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 93% rename from codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 7222606b..9f662416 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..96e7dea3 --- /dev/null +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..b7e340b2 --- /dev/null +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Meetings/Api/AssociationsApi.php b/codegen/Crm/Objects/Meetings/Api/AssociationsApi.php index dd99eed0..fc87879d 100644 --- a/codegen/Crm/Objects/Meetings/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Meetings/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two meetings + * Delete * - * @param string $meeting_id meeting_id (required) + * @param int $meeting_id meeting_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($meeting_id, $to_object_type, $to_object_id, $association_type) + public function archive($meeting_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($meeting_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two meetings + * Delete * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($meeting_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($meeting_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($meeting_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($meeting_id, $to_object_type, $to_object_id, /** * Operation archiveAsync * - * Remove an association between two meetings + * Delete * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($meeting_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($meeting_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two meetings + * Delete * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($meeting_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($meeting_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($meeting_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($meeting_id, $to_object_type, $to_object_id) { // verify the required parameter 'meeting_id' is set if ($meeting_id === null || (is_array($meeting_id) && count($meeting_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($meeting_id, $to_object_type, $to_object_id, $ass 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/meetings/{meetingId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($meeting_id, $to_object_type, $to_object_id, $ass $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($meeting_id, $to_object_type, $to_object_id, $ass /** * Operation create * - * Associate a meeting with another object + * Create * - * @param string $meeting_id meeting_id (required) + * @param int $meeting_id meeting_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Meetings\Model\Error + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function create($meeting_id, $to_object_type, $to_object_id, $association_type) + public function create($meeting_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a meeting with another object + * Create * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($meeting_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($meeting_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($meeting_id, $to_object_type, $to_object_id, /** * Operation createAsync * - * Associate a meeting with another object + * Create * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($meeting_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($meeting_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a meeting with another object + * Create * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($meeting_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($meeting_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($meeting_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($meeting_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($meeting_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'meeting_id' is set if ($meeting_id === null || (is_array($meeting_id) && count($meeting_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($meeting_id, $to_object_type, $to_object_id, $asso 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($meeting_id, $to_object_type, $to_object_id, $asso $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($meeting_id, $to_object_type, $to_object_id, $asso } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($meeting_id, $to_object_type, $to_object_id, $asso /** * Operation getAll * - * List associations of a meeting by type + * List * - * @param string $meeting_id meeting_id (required) + * @param int $meeting_id meeting_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ public function getAll($meeting_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($meeting_id, $to_object_type, $after = null, $limit = 500 /** * Operation getAllWithHttpInfo * - * List associations of a meeting by type + * List * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($meeting_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($meeting_id, $to_object_type, $after = null, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($meeting_id, $to_object_type, $after = null, ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($meeting_id, $to_object_type, $after = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($meeting_id, $to_object_type, $after = null, /** * Operation getAllAsync * - * List associations of a meeting by type + * List * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a meeting by type + * List * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($meeting_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($meeting_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $meeting_id (required) + * @param int $meeting_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php new file mode 100644 index 00000000..2068fc84 --- /dev/null +++ b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Meetings/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/Meetings/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..6aeef163 --- /dev/null +++ b/codegen/Crm/Objects/Meetings/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/Meetings/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index d7246414..ad78bc39 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\Meetings\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\Meetings\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\Meetings\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\Meetings\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/Meetings/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..4cdc1eb0 --- /dev/null +++ b/codegen/Crm/Objects/Meetings/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Meetings/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/Meetings/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..2a7feb7f --- /dev/null +++ b/codegen/Crm/Objects/Meetings/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Notes/Api/AssociationsApi.php b/codegen/Crm/Objects/Notes/Api/AssociationsApi.php index 654a01b7..f7dd910f 100644 --- a/codegen/Crm/Objects/Notes/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Notes/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two notes + * Delete * - * @param string $note_id note_id (required) + * @param int $note_id note_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($note_id, $to_object_type, $to_object_id, $association_type) + public function archive($note_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($note_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two notes + * Delete * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($note_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($note_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($note_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($note_id, $to_object_type, $to_object_id, $a /** * Operation archiveAsync * - * Remove an association between two notes + * Delete * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($note_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($note_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two notes + * Delete * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($note_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($note_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($note_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($note_id, $to_object_type, $to_object_id) { // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($note_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/notes/{noteId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($note_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($note_id, $to_object_type, $to_object_id, $associ /** * Operation create * - * Associate a note with another object + * Create * - * @param string $note_id note_id (required) + * @param int $note_id note_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Notes\Model\Error + * @return \HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function create($note_id, $to_object_type, $to_object_id, $association_type) + public function create($note_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a note with another object + * Create * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($note_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($note_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $as } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $as ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $as } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($note_id, $to_object_type, $to_object_id, $as /** * Operation createAsync * - * Associate a note with another object + * Create * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($note_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($note_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a note with another object + * Create * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($note_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($note_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($note_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($note_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($note_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($note_id, $to_object_type, $to_object_id, $associa 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($note_id, $to_object_type, $to_object_id, $associa $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($note_id, $to_object_type, $to_object_id, $associa } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($note_id, $to_object_type, $to_object_id, $associa /** * Operation getAll * - * List associations of a note by type + * List * - * @param string $note_id note_id (required) + * @param int $note_id note_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error + * @return \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ public function getAll($note_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($note_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a note by type + * List * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($note_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($note_id, $to_object_type, $after = null, $li switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($note_id, $to_object_type, $after = null, $li ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($note_id, $to_object_type, $after = null, $li case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($note_id, $to_object_type, $after = null, $li /** * Operation getAllAsync * - * List associations of a note by type + * List * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a note by type + * List * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($note_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($note_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $note_id (required) + * @param int $note_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php new file mode 100644 index 00000000..42543e84 --- /dev/null +++ b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Notes/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/Notes/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..4e5e46ac --- /dev/null +++ b/codegen/Crm/Objects/Notes/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 91% rename from codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/Notes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 2d768567..608090eb 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\Notes\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\Notes\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\Notes\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\Notes\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\Notes\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Notes\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/Notes/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..fd7c94e4 --- /dev/null +++ b/codegen/Crm/Objects/Notes/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Notes/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/Notes/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..d037da46 --- /dev/null +++ b/codegen/Crm/Objects/Notes/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\Notes\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Tasks/Api/AssociationsApi.php b/codegen/Crm/Objects/Tasks/Api/AssociationsApi.php index e1200632..6a63b1dc 100644 --- a/codegen/Crm/Objects/Tasks/Api/AssociationsApi.php +++ b/codegen/Crm/Objects/Tasks/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two tasks + * Delete * - * @param string $task_id task_id (required) + * @param int $task_id task_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($task_id, $to_object_type, $to_object_id, $association_type) + public function archive($task_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($task_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two tasks + * Delete * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($task_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($task_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($task_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($task_id, $to_object_type, $to_object_id, $a /** * Operation archiveAsync * - * Remove an association between two tasks + * Delete * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($task_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($task_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two tasks + * Delete * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($task_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($task_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($task_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($task_id, $to_object_type, $to_object_id) { // verify the required parameter 'task_id' is set if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($task_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($task_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($task_id, $to_object_type, $to_object_id, $associ /** * Operation create * - * Associate a task with another object + * Create * - * @param string $task_id task_id (required) + * @param int $task_id task_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Tasks\Model\Error + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function create($task_id, $to_object_type, $to_object_id, $association_type) + public function create($task_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a task with another object + * Create * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($task_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($task_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $as } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $as ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $as } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($task_id, $to_object_type, $to_object_id, $as /** * Operation createAsync * - * Associate a task with another object + * Create * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($task_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($task_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a task with another object + * Create * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($task_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($task_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($task_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($task_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($task_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'task_id' is set if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($task_id, $to_object_type, $to_object_id, $associa 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($task_id, $to_object_type, $to_object_id, $associa $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($task_id, $to_object_type, $to_object_id, $associa } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($task_id, $to_object_type, $to_object_id, $associa /** * Operation getAll * - * List associations of a task by type + * List * - * @param string $task_id task_id (required) + * @param int $task_id task_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ public function getAll($task_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($task_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a task by type + * List * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($task_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($task_id, $to_object_type, $after = null, $li switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($task_id, $to_object_type, $after = null, $li ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($task_id, $to_object_type, $after = null, $li case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($task_id, $to_object_type, $after = null, $li /** * Operation getAllAsync * - * List associations of a task by type + * List * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a task by type + * List * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($task_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($task_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $task_id (required) + * @param int $task_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php new file mode 100644 index 00000000..fdef588f --- /dev/null +++ b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Tasks/Model/AssociationSpecWithLabel.php b/codegen/Crm/Objects/Tasks/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..ac1c175c --- /dev/null +++ b/codegen/Crm/Objects/Tasks/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 91% rename from codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Objects/Tasks/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 1e88e709..c37a6b66 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Objects\Tasks\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Objects\Tasks\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Objects\Tasks\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Objects\Tasks\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Objects/Tasks/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..c3eec988 --- /dev/null +++ b/codegen/Crm/Objects/Tasks/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Tasks/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Objects/Tasks/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..2ed3da8d --- /dev/null +++ b/codegen/Crm/Objects/Tasks/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Products/Api/AssociationsApi.php b/codegen/Crm/Products/Api/AssociationsApi.php index a76377da..71f14485 100644 --- a/codegen/Crm/Products/Api/AssociationsApi.php +++ b/codegen/Crm/Products/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two products + * Delete * - * @param string $product_id product_id (required) + * @param int $product_id product_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($product_id, $to_object_type, $to_object_id, $association_type) + public function archive($product_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($product_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two products + * Delete * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($product_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($product_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($product_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($product_id, $to_object_type, $to_object_id, /** * Operation archiveAsync * - * Remove an association between two products + * Delete * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($product_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($product_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two products + * Delete * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($product_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($product_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($product_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($product_id, $to_object_type, $to_object_id) { // verify the required parameter 'product_id' is set if ($product_id === null || (is_array($product_id) && count($product_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($product_id, $to_object_type, $to_object_id, $ass 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/products/{productId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($product_id, $to_object_type, $to_object_id, $ass $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($product_id, $to_object_type, $to_object_id, $ass /** * Operation create * - * Associate a product with another object + * Create * - * @param string $product_id product_id (required) + * @param int $product_id product_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Products\Model\Error + * @return \HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Products\Model\Error */ - public function create($product_id, $to_object_type, $to_object_id, $association_type) + public function create($product_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a product with another object + * Create * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Products\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Products\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($product_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($product_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, ]; } - $returnType = '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($product_id, $to_object_type, $to_object_id, /** * Operation createAsync * - * Associate a product with another object + * Create * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($product_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($product_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a product with another object + * Create * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($product_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($product_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Products\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($product_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($product_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($product_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'product_id' is set if ($product_id === null || (is_array($product_id) && count($product_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($product_id, $to_object_type, $to_object_id, $asso 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($product_id, $to_object_type, $to_object_id, $asso $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($product_id, $to_object_type, $to_object_id, $asso } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($product_id, $to_object_type, $to_object_id, $asso /** * Operation getAll * - * List associations of a product by type + * List * - * @param string $product_id product_id (required) + * @param int $product_id product_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Products\Model\Error + * @return \HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Products\Model\Error */ public function getAll($product_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($product_id, $to_object_type, $after = null, $limit = 500 /** * Operation getAllWithHttpInfo * - * List associations of a product by type + * List * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Products\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Products\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($product_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($product_id, $to_object_type, $after = null, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($product_id, $to_object_type, $after = null, ]; } - $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($product_id, $to_object_type, $after = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($product_id, $to_object_type, $after = null, /** * Operation getAllAsync * - * List associations of a product by type + * List * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a product by type + * List * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($product_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($product_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $product_id (required) + * @param int $product_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Products/Model/AssociationSpec.php b/codegen/Crm/Products/Model/AssociationSpec.php new file mode 100644 index 00000000..655fa8d2 --- /dev/null +++ b/codegen/Crm/Products/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Products/Model/AssociationSpecWithLabel.php b/codegen/Crm/Products/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..2fc2fcaa --- /dev/null +++ b/codegen/Crm/Products/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Products/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Products/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Products/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Products/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index f4ea8d12..4973ca89 100644 --- a/codegen/Crm/Products/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Products/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Products\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Products\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Products\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Products\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Products\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Products\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Products\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Products/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Products/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..758d52b3 --- /dev/null +++ b/codegen/Crm/Products/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Products/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Products/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..53cc8358 --- /dev/null +++ b/codegen/Crm/Products/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Products\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Products\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Products\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Quotes/Api/AssociationsApi.php b/codegen/Crm/Quotes/Api/AssociationsApi.php index fb8a7e1a..386a332d 100644 --- a/codegen/Crm/Quotes/Api/AssociationsApi.php +++ b/codegen/Crm/Quotes/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two quotes + * Delete * - * @param string $quote_id quote_id (required) + * @param int $quote_id quote_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($quote_id, $to_object_type, $to_object_id, $association_type) + public function archive($quote_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($quote_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two quotes + * Delete * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($quote_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($quote_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($quote_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($quote_id, $to_object_type, $to_object_id, $ /** * Operation archiveAsync * - * Remove an association between two quotes + * Delete * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($quote_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($quote_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two quotes + * Delete * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($quote_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($quote_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($quote_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($quote_id, $to_object_type, $to_object_id) { // verify the required parameter 'quote_id' is set if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($quote_id, $to_object_type, $to_object_id, $assoc 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/quotes/{quoteId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($quote_id, $to_object_type, $to_object_id, $assoc $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($quote_id, $to_object_type, $to_object_id, $assoc /** * Operation create * - * Associate a quote with another object + * Create * - * @param string $quote_id quote_id (required) + * @param int $quote_id quote_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Quotes\Model\Error + * @return \HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Quotes\Model\Error */ - public function create($quote_id, $to_object_type, $to_object_id, $association_type) + public function create($quote_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a quote with another object + * Create * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Quotes\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Quotes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($quote_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($quote_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $a } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $a ]; } - $returnType = '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $a } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($quote_id, $to_object_type, $to_object_id, $a /** * Operation createAsync * - * Associate a quote with another object + * Create * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($quote_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($quote_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a quote with another object + * Create * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($quote_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($quote_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Quotes\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($quote_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($quote_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($quote_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'quote_id' is set if ($quote_id === null || (is_array($quote_id) && count($quote_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($quote_id, $to_object_type, $to_object_id, $associ 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($quote_id, $to_object_type, $to_object_id, $associ $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($quote_id, $to_object_type, $to_object_id, $associ } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($quote_id, $to_object_type, $to_object_id, $associ /** * Operation getAll * - * List associations of a quote by type + * List * - * @param string $quote_id quote_id (required) + * @param int $quote_id quote_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Quotes\Model\Error + * @return \HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Quotes\Model\Error */ public function getAll($quote_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($quote_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a quote by type + * List * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Quotes\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Quotes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($quote_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($quote_id, $to_object_type, $after = null, $l switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($quote_id, $to_object_type, $after = null, $l ]; } - $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($quote_id, $to_object_type, $after = null, $l case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($quote_id, $to_object_type, $after = null, $l /** * Operation getAllAsync * - * List associations of a quote by type + * List * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a quote by type + * List * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($quote_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($quote_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $quote_id (required) + * @param int $quote_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Quotes/Model/AssociationSpec.php b/codegen/Crm/Quotes/Model/AssociationSpec.php new file mode 100644 index 00000000..df7150b3 --- /dev/null +++ b/codegen/Crm/Quotes/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Quotes/Model/AssociationSpecWithLabel.php b/codegen/Crm/Quotes/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..64ab4889 --- /dev/null +++ b/codegen/Crm/Quotes/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Quotes/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Quotes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Quotes/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Quotes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index ea4663de..d90c4357 100644 --- a/codegen/Crm/Quotes/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Quotes/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Quotes\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Quotes\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Quotes\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Quotes\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Quotes\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Quotes\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Quotes\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Quotes/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Quotes/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..607ea378 --- /dev/null +++ b/codegen/Crm/Quotes/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Quotes/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Quotes/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..59a88e4a --- /dev/null +++ b/codegen/Crm/Quotes/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Quotes\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Quotes\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Quotes\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Tickets/Api/AssociationsApi.php b/codegen/Crm/Tickets/Api/AssociationsApi.php index 84425527..5118da2b 100644 --- a/codegen/Crm/Tickets/Api/AssociationsApi.php +++ b/codegen/Crm/Tickets/Api/AssociationsApi.php @@ -118,39 +118,37 @@ public function getConfig() /** * Operation archive * - * Remove an association between two tickets + * Delete * - * @param string $ticket_id ticket_id (required) + * @param int $ticket_id ticket_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function archive($ticket_id, $to_object_type, $to_object_id, $association_type) + public function archive($ticket_id, $to_object_type, $to_object_id) { - $this->archiveWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type); + $this->archiveWithHttpInfo($ticket_id, $to_object_type, $to_object_id); } /** * Operation archiveWithHttpInfo * - * Remove an association between two tickets + * Delete * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + public function archiveWithHttpInfo($ticket_id, $to_object_type, $to_object_id) { - $request = $this->archiveRequest($ticket_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($ticket_id, $to_object_type, $to_object_id); try { $options = $this->createHttpClientOption(); @@ -207,19 +205,18 @@ public function archiveWithHttpInfo($ticket_id, $to_object_type, $to_object_id, /** * Operation archiveAsync * - * Remove an association between two tickets + * Delete * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($ticket_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsync($ticket_id, $to_object_type, $to_object_id) { - return $this->archiveAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + return $this->archiveAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id) ->then( function ($response) { return $response[0]; @@ -230,20 +227,19 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Remove an association between two tickets + * Delete * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + public function archiveAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id) { $returnType = ''; - $request = $this->archiveRequest($ticket_id, $to_object_type, $to_object_id, $association_type); + $request = $this->archiveRequest($ticket_id, $to_object_type, $to_object_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -271,15 +267,14 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($ticket_id, $to_object_type, $to_object_id, $association_type) + public function archiveRequest($ticket_id, $to_object_type, $to_object_id) { // verify the required parameter 'ticket_id' is set if ($ticket_id === null || (is_array($ticket_id) && count($ticket_id) === 0)) { @@ -299,12 +294,6 @@ public function archiveRequest($ticket_id, $to_object_type, $to_object_id, $asso 'Missing the required parameter $to_object_id when calling archive' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling archive' - ); - } $resourcePath = '/crm/v4/objects/tickets/{ticketId}/associations/{toObjectType}/{toObjectId}'; $formParams = []; @@ -339,14 +328,6 @@ public function archiveRequest($ticket_id, $to_object_type, $to_object_id, $asso $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -418,40 +399,40 @@ public function archiveRequest($ticket_id, $to_object_type, $to_object_id, $asso /** * Operation create * - * Associate a ticket with another object + * Create * - * @param string $ticket_id ticket_id (required) + * @param int $ticket_id ticket_id (required) * @param string $to_object_type to_object_type (required) - * @param string $to_object_id to_object_id (required) - * @param string $association_type association_type (required) + * @param int $to_object_id to_object_id (required) + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $association_spec association_spec (required) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Tickets\Model\Error + * @return \HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Tickets\Model\Error */ - public function create($ticket_id, $to_object_type, $to_object_id, $association_type) + public function create($ticket_id, $to_object_type, $to_object_id, $association_spec) { - list($response) = $this->createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type); + list($response) = $this->createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_spec); return $response; } /** * Operation createWithHttpInfo * - * Associate a ticket with another object + * Create * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $association_spec (required) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_spec) { - $request = $this->createRequest($ticket_id, $to_object_type, $to_object_id, $association_type); + $request = $this->createRequest($ticket_id, $to_object_type, $to_object_id, $association_spec); try { $options = $this->createHttpClientOption(); @@ -489,18 +470,18 @@ public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $ } switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + case 201: + if ('\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -521,7 +502,7 @@ public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $ ]; } - $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -539,10 +520,10 @@ public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $ } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -563,19 +544,19 @@ public function createWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $ /** * Operation createAsync * - * Associate a ticket with another object + * Create * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($ticket_id, $to_object_type, $to_object_id, $association_type) + public function createAsync($ticket_id, $to_object_type, $to_object_id, $association_spec) { - return $this->createAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + return $this->createAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_spec) ->then( function ($response) { return $response[0]; @@ -586,20 +567,20 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Associate a ticket with another object + * Create * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_type) + public function createAsyncWithHttpInfo($ticket_id, $to_object_type, $to_object_id, $association_spec) { - $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations'; - $request = $this->createRequest($ticket_id, $to_object_type, $to_object_id, $association_type); + $returnType = '\HubSpot\Client\Crm\Tickets\Model\LabelsBetweenObjectPair'; + $request = $this->createRequest($ticket_id, $to_object_type, $to_object_id, $association_spec); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -640,15 +621,15 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) - * @param string $to_object_id (required) - * @param string $association_type (required) + * @param int $to_object_id (required) + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $association_spec (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($ticket_id, $to_object_type, $to_object_id, $association_type) + public function createRequest($ticket_id, $to_object_type, $to_object_id, $association_spec) { // verify the required parameter 'ticket_id' is set if ($ticket_id === null || (is_array($ticket_id) && count($ticket_id) === 0)) { @@ -668,10 +649,10 @@ public function createRequest($ticket_id, $to_object_type, $to_object_id, $assoc 'Missing the required parameter $to_object_id when calling create' ); } - // verify the required parameter 'association_type' is set - if ($association_type === null || (is_array($association_type) && count($association_type) === 0)) { + // verify the required parameter 'association_spec' is set + if ($association_spec === null || (is_array($association_spec) && count($association_spec) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type when calling create' + 'Missing the required parameter $association_spec when calling create' ); } @@ -708,14 +689,6 @@ public function createRequest($ticket_id, $to_object_type, $to_object_id, $assoc $resourcePath ); } - // path params - if ($association_type !== null) { - $resourcePath = str_replace( - '{' . 'associationType' . '}', - ObjectSerializer::toPathValue($association_type), - $resourcePath - ); - } if ($multipart) { @@ -725,12 +698,18 @@ public function createRequest($ticket_id, $to_object_type, $to_object_id, $assoc } else { $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($association_spec)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($association_spec)); + } else { + $httpBody = $association_spec; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -787,16 +766,16 @@ public function createRequest($ticket_id, $to_object_type, $to_object_id, $assoc /** * Operation getAll * - * List associations of a ticket by type + * List * - * @param string $ticket_id ticket_id (required) + * @param int $ticket_id ticket_id (required) * @param string $to_object_type to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Tickets\Model\Error + * @return \HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Tickets\Model\Error */ public function getAll($ticket_id, $to_object_type, $after = null, $limit = 500) { @@ -807,16 +786,16 @@ public function getAll($ticket_id, $to_object_type, $after = null, $limit = 500) /** * Operation getAllWithHttpInfo * - * List associations of a ticket by type + * List * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getAllWithHttpInfo($ticket_id, $to_object_type, $after = null, $limit = 500) { @@ -859,17 +838,17 @@ public function getAllWithHttpInfo($ticket_id, $to_object_type, $after = null, $ switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -890,7 +869,7 @@ public function getAllWithHttpInfo($ticket_id, $to_object_type, $after = null, $ ]; } - $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -911,7 +890,7 @@ public function getAllWithHttpInfo($ticket_id, $to_object_type, $after = null, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging', + '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -932,9 +911,9 @@ public function getAllWithHttpInfo($ticket_id, $to_object_type, $after = null, $ /** * Operation getAllAsync * - * List associations of a ticket by type + * List * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -955,9 +934,9 @@ function ($response) { /** * Operation getAllAsyncWithHttpInfo * - * List associations of a ticket by type + * List * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) @@ -967,7 +946,7 @@ function ($response) { */ public function getAllAsyncWithHttpInfo($ticket_id, $to_object_type, $after = null, $limit = 500) { - $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseAssociatedIdForwardPaging'; + $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; $request = $this->getAllRequest($ticket_id, $to_object_type, $after, $limit); return $this->client @@ -1009,7 +988,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $ticket_id (required) + * @param int $ticket_id (required) * @param string $to_object_type (required) * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param int $limit The maximum number of results to display per page. (optional, default to 500) diff --git a/codegen/Crm/Tickets/Model/AssociationSpec.php b/codegen/Crm/Tickets/Model/AssociationSpec.php new file mode 100644 index 00000000..58dd1ab0 --- /dev/null +++ b/codegen/Crm/Tickets/Model/AssociationSpec.php @@ -0,0 +1,392 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['association_category'] = $data['association_category'] ?? null; + $this->container['association_type_id'] = $data['association_type_id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Tickets/Model/AssociationSpecWithLabel.php b/codegen/Crm/Tickets/Model/AssociationSpecWithLabel.php new file mode 100644 index 00000000..425fa027 --- /dev/null +++ b/codegen/Crm/Tickets/Model/AssociationSpecWithLabel.php @@ -0,0 +1,422 @@ + + */ +class AssociationSpecWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpecWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'type_id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'type_id' => 'int32', + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'type_id' => 'typeId', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'type_id' => 'setTypeId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'type_id' => 'getTypeId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = $data['category'] ?? null; + $this->container['type_id'] = $data['type_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Tickets/Model/CollectionResponseAssociatedIdForwardPaging.php b/codegen/Crm/Tickets/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php similarity index 92% rename from codegen/Crm/Tickets/Model/CollectionResponseAssociatedIdForwardPaging.php rename to codegen/Crm/Tickets/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index 0855c49c..626160cc 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseAssociatedIdForwardPaging.php +++ b/codegen/Crm/Tickets/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseMultiAssociatedObjectWithLabelForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * * @var string */ - protected static $openAPIModelName = 'CollectionResponseAssociatedIdForwardPaging'; + protected static $openAPIModelName = 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseAssociatedIdForwardPaging implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Crm\Tickets\Model\AssociatedId[]', + 'results' => '\HubSpot\Client\Crm\Tickets\Model\MultiAssociatedObjectWithLabel[]', 'paging' => '\HubSpot\Client\Crm\Tickets\Model\ForwardPaging' ]; @@ -215,7 +215,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Crm\Tickets\Model\AssociatedId[] + * @return \HubSpot\Client\Crm\Tickets\Model\MultiAssociatedObjectWithLabel[] */ public function getResults() { @@ -225,7 +225,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Crm\Tickets\Model\AssociatedId[] $results results + * @param \HubSpot\Client\Crm\Tickets\Model\MultiAssociatedObjectWithLabel[] $results results * * @return self */ diff --git a/codegen/Crm/Tickets/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Tickets/Model/LabelsBetweenObjectPair.php new file mode 100644 index 00000000..d495ffd7 --- /dev/null +++ b/codegen/Crm/Tickets/Model/LabelsBetweenObjectPair.php @@ -0,0 +1,455 @@ + + */ +class LabelsBetweenObjectPair implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LabelsBetweenObjectPair'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from_object_type_id' => 'string', + 'from_object_id' => 'int', + 'to_object_type_id' => 'string', + 'to_object_id' => 'int', + 'labels' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from_object_type_id' => null, + 'from_object_id' => 'int32', + 'to_object_type_id' => null, + 'to_object_id' => 'int32', + 'labels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from_object_type_id' => 'fromObjectTypeId', + 'from_object_id' => 'fromObjectId', + 'to_object_type_id' => 'toObjectTypeId', + 'to_object_id' => 'toObjectId', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from_object_type_id' => 'setFromObjectTypeId', + 'from_object_id' => 'setFromObjectId', + 'to_object_type_id' => 'setToObjectTypeId', + 'to_object_id' => 'setToObjectId', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from_object_type_id' => 'getFromObjectTypeId', + 'from_object_id' => 'getFromObjectId', + 'to_object_type_id' => 'getToObjectTypeId', + 'to_object_id' => 'getToObjectId', + 'labels' => 'getLabels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from_object_type_id'] = $data['from_object_type_id'] ?? null; + $this->container['from_object_id'] = $data['from_object_id'] ?? null; + $this->container['to_object_type_id'] = $data['to_object_type_id'] ?? null; + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['labels'] = $data['labels'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from_object_type_id'] === null) { + $invalidProperties[] = "'from_object_type_id' can't be null"; + } + if ($this->container['from_object_id'] === null) { + $invalidProperties[] = "'from_object_id' can't be null"; + } + if ($this->container['to_object_type_id'] === null) { + $invalidProperties[] = "'to_object_type_id' can't be null"; + } + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['labels'] === null) { + $invalidProperties[] = "'labels' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from_object_type_id + * + * @return string + */ + public function getFromObjectTypeId() + { + return $this->container['from_object_type_id']; + } + + /** + * Sets from_object_type_id + * + * @param string $from_object_type_id from_object_type_id + * + * @return self + */ + public function setFromObjectTypeId($from_object_type_id) + { + $this->container['from_object_type_id'] = $from_object_type_id; + + return $this; + } + + /** + * Gets from_object_id + * + * @return int + */ + public function getFromObjectId() + { + return $this->container['from_object_id']; + } + + /** + * Sets from_object_id + * + * @param int $from_object_id from_object_id + * + * @return self + */ + public function setFromObjectId($from_object_id) + { + $this->container['from_object_id'] = $from_object_id; + + return $this; + } + + /** + * Gets to_object_type_id + * + * @return string + */ + public function getToObjectTypeId() + { + return $this->container['to_object_type_id']; + } + + /** + * Sets to_object_type_id + * + * @param string $to_object_type_id to_object_type_id + * + * @return self + */ + public function setToObjectTypeId($to_object_type_id) + { + $this->container['to_object_type_id'] = $to_object_type_id; + + return $this; + } + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets labels + * + * @return string[] + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[] $labels labels + * + * @return self + */ + public function setLabels($labels) + { + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Tickets/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Tickets/Model/MultiAssociatedObjectWithLabel.php new file mode 100644 index 00000000..fcfdf8a4 --- /dev/null +++ b/codegen/Crm/Tickets/Model/MultiAssociatedObjectWithLabel.php @@ -0,0 +1,356 @@ + + */ +class MultiAssociatedObjectWithLabel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MultiAssociatedObjectWithLabel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to_object_id' => 'int', + 'association_types' => '\HubSpot\Client\Crm\Tickets\Model\AssociationSpecWithLabel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to_object_id' => 'int32', + 'association_types' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to_object_id' => 'toObjectId', + 'association_types' => 'associationTypes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to_object_id' => 'setToObjectId', + 'association_types' => 'setAssociationTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to_object_id' => 'getToObjectId', + 'association_types' => 'getAssociationTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['to_object_id'] = $data['to_object_id'] ?? null; + $this->container['association_types'] = $data['association_types'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to_object_id'] === null) { + $invalidProperties[] = "'to_object_id' can't be null"; + } + if ($this->container['association_types'] === null) { + $invalidProperties[] = "'association_types' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to_object_id + * + * @return int + */ + public function getToObjectId() + { + return $this->container['to_object_id']; + } + + /** + * Sets to_object_id + * + * @param int $to_object_id to_object_id + * + * @return self + */ + public function setToObjectId($to_object_id) + { + $this->container['to_object_id'] = $to_object_id; + + return $this; + } + + /** + * Gets association_types + * + * @return \HubSpot\Client\Crm\Tickets\Model\AssociationSpecWithLabel[] + */ + public function getAssociationTypes() + { + return $this->container['association_types']; + } + + /** + * Sets association_types + * + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpecWithLabel[] $association_types association_types + * + * @return self + */ + public function setAssociationTypes($association_types) + { + $this->container['association_types'] = $association_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + +